A Simple Security System in C++

  1. C++ is one of the most advanced and one of the most useful programming language in the present world of programming.If you are searching for good complier or interpreter for c++.You may check these
  2. Visual studio
  3. Dev c++

Starting the code:

#include <iostream> 
#include <string> 

using namespace std;

int main()
{
  
	const string USERNAME = "Prerak1234";
	const string PASSWORD = "123400";
	
	string username, password;



	
     
	cout << "Enter Username : ";
	cin >> username;

	
	if(username.length() < 4)
	{
		cout << "Username length must be atleast 4 characters long.";
	}
	else  
	{
		cout << "Enter Password : ";
		cin >> password;
		
		if(password.length() < 6)
		{
			cout << "Password length must be atleast 6 characters long.";
		}
		else 
		{
			
			if(username == USERNAME && password == PASSWORD)
			{
				cout << "User id correct" << endl;
			}
			else
			{
				cout << "Invalid password" << endl;
			}
		}
	}

	return 0;
}

PS : You may change the password and username as you correct

See the user credentials are incorrect.

See the user credentials are correct.   Author and editor-Prerak giri