I need to make a loop that gets three strings as input from a user and stop if nothing is entered. My code
while(true){ cout << "Enter string1 string2 string3: "; getline(cin,s1, ' '); if(s1.empty()) break; getline(cin, s2, ' '); getline(cin, s3); } If I don't enter anything, getline waits until I input at least a space. How to make it stop when nothing is entered?
if(s1.empy())->if(s1.empty())