The program consists of collecting the names of people, (only their names, not last names) showing them by screen, until finding a string that is 'END'.
Program format: (first name, last name)
Example:
Manuel, Perez
Pepe, Geneva
Lola, Flowers
END
#include<iostream>
#include<string>
using namespace std;
int main()
{
string aux;
getline(cin,aux,',');
while(aux != "FIN")
{
cout << aux;
getline(cin,aux,',');
}
return 0;
}
Since we only want the name, we use a
getline (cin, aux, ',')
I end up finding a comma, excluding this one. However, the moment we enter 'END', the getline will wait for a comma and until it is entered the program will not end.
Any suggestions to fix this?