PHP expert |
|
#include <iostream>
#include <string>
using namespace std;
int ret, retu;
string pass_in, user_in;
string user = "Simon";
string pass = "test";
int checkLogin(string user_inn, string pass_inn) {
if(user_in == "" || pass_in == "") {
ret = 2;
}
else {
if(user_inn == user && pass_inn == pass) {
ret = 0;
}
else {
ret = 1;
}
}
return ret;
}
int main ()
{
cout << "Username: ";
getline (cin, user_in);
cout << "Password: ";
getline (cin, pass_in);
ret = checkLogin(user_in, pass_in);
switch(ret) {
case 0:
cout << "Access Denied.\n";
break;
case 1:
cout << "Access Denied.\n";
break;
case 2:
cout << "Fill in all fields";
break;
default:
cout << "Access Denied.\n";
break;
}
cin.get();
}
#include <iostream> #include <string> using namespace std; int ret, retu; string pass_in, user_in; string user = "Simon"; string pass = "test"; int checkLogin(string user_inn, string pass_inn) { if(user_in == "" || pass_in == "") { ret = 2; } else { if(user_inn == user && pass_inn == pass) { ret = 0; } else { ret = 1; } } return ret; } int main () { cout << "Username: "; getline (cin, user_in); cout << "Password: "; getline (cin, pass_in); ret = checkLogin(user_in, pass_in); switch(ret) { case 0: cout << "Access Denied.\n"; break; case 1: cout << "Access Denied.\n"; break; case 2: cout << "Fill in all fields"; break; default: cout << "Access Denied.\n"; break; } cin.get(); }
yoo, ik typ het juiste user en pass in, maar krijg telkens Access denied; ik weet dat het case-sensitive is, dus ik geef het juist in ;)
|