i am writing a program where i am trying to implement the following code:
int main(){
string inputcmd;
while (getline(cin, inputcmd)){
cout << "TYPE A COMMAND" << endl;
cin >> inputcmd;
cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');
if (inputcmd == "make"){
cout << "MAKING NEW PROJECT" << endl;
get_project(cin);
}
else if (inputcmd == "retrieve"){
cout << "RETRIEVING YOUR PROJECT" << endl;
}
}
return 0;
}
i am trying to use the cin.ignore property to clear the buffer of the newline character currently residing in the buffer at that given time, however when i try and compile it is giving me a bunch of gibberish compiler error? why is this how can i fix this?