Im trying to get the program work correctly and its running, but the problem is as soon as i enter the username and hit enter, it doesnt allow me to enter password to be entered but it displays all the process after that.
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
char inputUser, inputPass;
int foundFlag, k;
int userName [10];
int passWord [10];
for (k = 0; k <= 2; k++){
cout <<"Enter the Username: ";
cin >> userName[k];
cout <<"Enter the Password: ";
cin >> passWord[k];}
cout <<"Input User: ";
cin >> inputUser;
foundFlag = false;
for (k = 1; k <= 2; ++k){
if (inputUser = userName[k])
foundFlag = true;
cout <<"Input Pass: ";
cin >> inputPass;
if (inputPass = passWord[k])
cout <<"Access granted.";
else
cout <<"Username and password do not match.";
}
if (foundFlag = false)
cout <<"Username not Found";
system("PAUSE");
return 0;
}
and this is what im getting as soon i enter the username and hit enter
1 2 3 4
Enter the Username: John
Enter the Password: Enter the Username: Enter the Password: Enter the Username:
Enter the Password: Input User: Input Pass: Access granted.Input Pass: Access gr
anted.Press any key to continue . . .