Gw Temp


Tutorial - 'C++ Login with Numbers' by Guest

An item about Programming Languages posted on


A nice basic C++ tutorial that guides you through making a simple login program.


A simple program of C++ can often be contructed of simple if statement. These are inside the main() function. They are farely simple to contstruct. Say you have a program written somewhat like this:
//This program gets the number of the user that is logging in
int main()
int passwrd; // defines that passwrd is indeed an integer
passwrd=1356; // Gives a definate answer to the variable //defines password
cout<<"What is the password?";
cin>>passwrd; //gets number from the user.
if (passwrd==1356) //tells what's going to
{ //happen when is equal to
cout<<"Valid user! Logging you into The Matrix...";

cin>>passwrd; //verifies once again
if (passwrd!=1356)
cout<<"Invalid user! Reporting!/n";
while(1) //infinite loop that wastes time and scares stupid people.
}//closes while 1 infinite loop!
}//closes if

return 0; //returns to operating system
Now experienced programmers can take this a step further to make it actually log into another program. Well another thing that may help is if you make sure that the input of characters doesn't change the outcome of the program. But that's just some homework for you to work on, once you get a C++ compiler. So have fun!