Nice name shadowsora15. Reminds my of Anti-Form in Kingdom Hearts 2. Anyhow I would recommend you switch from arrays to std::string's. strings are more stable, and alot easier to work with.
which looks easier?
Code:
char x[26];
char y[16];
cout<<"Enter your user: ";
cin.getline(x, 26);
line();
cout<<"Enter your password: ";
cin.getline(y, 16);
line();
cout<<"You entered "<<user<< " " <<pass<<"\n";
if( strcmp (user, x) == 0)
{
if( strcmp (pass, y) == 0)
{
transaction();
}
}
else
{
cout<<"Wrong\n";
login();
}
or
Code:
std::string x;
std::string y;
cout<<"Enter your user: ";
getline(cin, x, '\n');
cout << endl;
cout<<"Enter your password: ";
getline(cin, y, '\n');
cout << endl;
cout<<"You entered "<<user<< " " <<pass<<"\n";
if(user.compare(x) == 0)
{
if(pass.compare(y) == 0)
{
transaction();
}
}
else
{
cout<<"Wrong\n";
login();
}
Really I guess it is it up to preference in the end. I hate giving biased opinions. I just think that strings are easier than char arrays.
also if you are going to use the line() function, you may want to make it inline so that it is a little quicker if you use it hundreds of times.