Sorry for the poor question but I really do not know what is happening.
while (true) {
string choice;
cout << ">>> ";
cin >> choice;
if (choice == "hi") {
cout << "Whats up?" << endl;
} else {
cout << "error" << endl;
}
}
If I compile this and then input "hi" it will show
>>> hi
Whats up?
>>>
but if I do "hi hi"
>>> hi hi
Whats up?
>>> Whats up?
>>>
It will show that. Why is it showing Whats up? twice instead of the error message?