News

Log In Sponsors
Partner Sites





Simple C++ Code



//Written by Arman Iqbal #include <iostream.h> main() { int med; int pass; int correct1 = 12345; //password for user nr 12 int correct2 = 54321; //password for user nr 24 cout << "Type in your membership number : \n"; cin >> med; switch (med) { case 12: cout << "Type in your password : \n"; cin >> pass; if (pass == correct1) { cout << "You have successfully logged into your account \n"; break; } else { cout << "Your password is incorrect. Run the program again. \n"; break; } case 24: cout << "Type in your password \n"; cin >> pass; if (pass == correct2) { cout << "You have successfully logged into your account \n"; break; } else { cout << "Your password is incorrect. Run the program again. \n"; } default: cout << "The membership number is invalid. Access denied.\n\n"; } return 0; }

Click here to read the whole forum topic