when i run the program i'm writting if i type 2 words for the name then the cin for grade is skipped and when cout 0 is displayed
1 2 3 4 5 6 7 8 9
istream& operator>> (istream &in, Alumno &al)
{
cout << "\ntype student Id: \n";
in >> al.id;
cout << "\nType student name: \n";
in >> al.name; // when i write more than 1 word
cout << "\ntype student grade: \n";
in >> al.grade; // this one is skipped
return in;
i tried changing the name cin for a getline but then when i run it is skipped so i end up with no cin for name
1 2 3 4 5 6 7 8 9 10
istream& operator>> (istream &in, Alumno &al)
{
cout << "\ntype student Id: \n";
in >> al.id;
cout << "\nType student name: \n";
getline(in , al.name); // now this one is skipped
cout << "\ntype student grade: \n";
in >> al.grade; // and this works
return in;
}