What am I doing wrong? I want this expression to be displayed/work after my input: cout << "Please enter your Agent ID."; But it would not register the whole word of my input: log in when I type it with space. If it was a word without space it would register it and do the if statement properly if the condition is met.
So I don't know what I am doing wrong.
Here's the Code:
#include <iostream>
#include <string>
int main()
{
using namespace std;
string input1;
cout << "Welcome to AgentOS" << endl;
cout << "To log in, please type \"log in\" " << endl;
cin >> input1;
if (getline(cin, input1) && input1 == "log in")
{
cout << "Please enter your Agent ID." << endl;
}
return 0;
}
Instead of display "Please enter your Agent ID", it would just simply return to 0 after I type in log in.
P.S. I am sorry I am still a beginner.