I have a retrieve function, but I am not sure why it isnt working like I want it to with getline? Here is the code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
string sInID,sLN,sFN,sGPA;
string selecting = "";
int keeptrack;
cout << "Please select how to retrieve by entering the WORDS IN THE PARENTHESIS ONLY: ID (id) Last(last) First (first) or GPA(gpa)?" << endl;
getline(cin, selecting);
cout << selecting;
if (selecting != "id" || selecting != "last" || selecting != "first" || selecting != "gpa" )
{
cout << "Incorrect!" << endl;
Retrieve();
}
if (selecting == "id")
{
cout << "Please enter Student ID" << endl;
cin >> sInID;
retrieveID(sInID);
}
and so on, but that is the main part to see. It ALWAYS outputs "Incorrect!" and loops into function, even though I type in "last" or "id". :( Can someone please help to figure out how to fix it or what I am doing wrong? Thank you!
edit:I cout selecting to make sure it takes the string like I type it, and it does....so i am really lost.