Beginner problem
When i input more than 1 word, something like "1 2 3" output is 3x "Odgovor nije validan" how can i fix this?
1 2 3 4 5 6 7 8 9 10 11 12 13
|
string odgovor;
while (true) {
cout << "U svojoj sobi si, odaberi sta zelis uraditi \n(izaci, ostati)\n";
cin >> odgovor;
if (odgovor == "izaci")
break;
if (odgovor == "ostati")
continue;
else
cout << "Odgovor nije validan! \n";
}
|
Use
getline( cin, odgovor );
Topic archived. No new replies allowed.