I'm learning functions now in C ++ and behold, I've been trying to run this program. It turns out that when I run it it just will not let me type the value of cin>>p;
it just ignores the command and moves on to the next one. I do not know what is happening. The program is this:
#include <iostream>
#include <conio.h>
using namespace std;
float p,mai=0;
int i;
char nome,pesado;
void topo(){
system("cls");
cout<<"------------------------------------"<<endl;
cout<<" D E T E C T O R DE P E S A D O"<<endl;
cout<<" Maior peso ate agora: "<<mai<<" kg"<<endl;
cout<<"------------------------------------"<<endl;
}
int main (void) {
topo ();
do{
i+=1;
cout<<"Digite o nome e depois o peso: "<<endl;
cin>>nome;
cout<<"\n";
cin>>p;
if (p>mai){
mai =p;
pesado =nome;
}
topo();
}while(i<=5);
topo();
cout<<"A pessoa mais pesada foi "<<pesado<<"com "<<mai<<" kg"<<endl;
}