Hi! I'm a very new freshman without any programming experience. Not sure if I posted my question in the right space. Sorry. Recently I was stuck in Xcode while trying to perform the std::getline(). Here's my code:
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{string username;
string passwords;
cout<<"Username:"<<"\n";
getline(cin, username, "\n");
cout<<"Passwords:"<<"\n";
getline(cin, passwords, "\n")
if (username=="Root" && passwords=="xyzz"){cout<<"Welcome Root.";}
else{cout<<"Please re-check Username&Passwords.";}
}
So is there any mistakes? Cause I couldn't run the program, because right after I typed in "getline()", Xcode display a small Exclamation Mark next to it and written "get line() file not found" and "No matching function for call to getline". So can somebody tell me why I fail to run it and provided with solutions. Is there any setting in Xcode need to be done before using getline()? Thank you so much.