[C++] Username & Password Validation using If- else Statements.

0622.sdt-microsoft-facebook-c-.jpg

We have saved username and password in a variable and prompt username to enter login details. If user provide's the correct details with actual USERNAME and PASSWORD it displays a message " correct credentials "" ...

else if you input a wrong username nd password it displays " ALERT! ALERT!! ALERT!!! WRONG USERNAME AND PASSWORD !! PLS TRY AGAIN LATER, THANK YOU " ...

Code below: --

#include <iostream>
#include <string>
using namespace std;
int main()
{
const string USERNAME = "vibeloaded";
const string PASSWORD = "1234";
string username, password;

cout << "ENTER YOUR USERNAME : ";
cin >> username;
cout << "ENTER YOUR PASSWORD : ";
cin >> password;
if (username == USERNAME && password == PASSWORD)
{
    cout << "==> CORRECT CREDENTIALS"<<endl;
}
else
{
    cout <<"==> ALERT! ALERT!! ALERT!!! WRONG USERNAME AND PASSWORD !! PLS TRY AGAIN LATER, THANK YOU."<<endl;
}
return 0;


<Download File now: - DOWNLOAD FILE

0 Response to "[C++] Username & Password Validation using If- else Statements."

Post a Comment