ok, i got to thinking, why not make a fake login screen for fun, since i was looking at a lesson in my book (not school) and it was talking about preprocessor directives, and it just so happens it was showing masking of characters. I made a login screen that asks for a user, then if the user checks out, then it asks for a password, but when i compile the program, it says "no matching function for call to `strcmp(std::string&, const char[7])' "
here is some of the code, i know something is wrong in the highlighted part, but i cant depict the problem...
Code:string Pass() { string numAsString = " "; char ch = getch(); while ( ch != '\r' ) { //\r is the enter key cout << '*'; numAsString += ch; ch = getch(); } return numAsString; } int main() { char user[50]; cout << "Plese Enter Your Username: "; cin.get( user, 50 ); if ( strcmp ( user, "Warhawk" ) == 0 ) { cout << endl << "Enter Password: "; string pass1 = Pass(); if ( strcmp ( pass1, "password" ) == 0 ) { system("cls"); cout << "Welcome!" << endl;



LinkBack URL
About LinkBacks


