C++ Login system Code
Hello All ,
This login system to get access to program .
That's my code
simple but nice , what about it ?
That's make the user enter a wrong info. for 5 times then terminate [ doesn't terminate at the first time ] .
This login system to get access to program .
That's my code
Code:
#include <iostream>
using namespace std;
int main()
{
string name,password;
cout << "enter your name : ";
cin >> name;
cout << "enter your password : ";
cin >> password;
if (password == "123456")
{
cout << "Hello , " << name << endl;
}
else
{
cout << "Wrong Password" <<endl;
return 0;
}
cout << "here comes our program . . . . . . ";
return 0;
}
Code:
#include <iostream>
using namespace std;
int main()
{
string name,password; int x = 1;
login :
cout << "enter your name : ";
cin >> name;
cout << "enter your password : ";
cin >> password;
if (password == "123456")
{
cout << "Hello , " << name << endl;
}
else if (x == 5)
{
cout << "Wrong Username Or Password for 5 times .. Program is terminating .";
return 0;
}
else
{
cout << "Wrong Username Or Password , Please Try again . " << x << " Out Of 5" <<endl;
x++;
goto login;
}
cout << "here comes our program . . . . . . ";
return 0;

