Here's a simple getting password tutorial.
First, you'll start off with the #includes.
- Code:
-
#include <iostream>
#include <windows.h>
Simple, right? Not that hard. Now we move on to the main.
- Code:
-
using namespace std;
int main()
Now here is where it gets a little tricky. First, you'll need the string.
- Code:
-
string pass;
That's the main thing you want. Now here, we'll go to the main box message. It's going to ask you, to enter a password. But, you can change it. I'm just using an example.
- Code:
-
cout<<"Please enter the hidden password. Here's a hint. Program"<<endl;
So far, you should have it looking like this.
- Code:
-
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
string pass:
cout<<"Please enter the hidden password. Here's a hint. Program"<<endl;
Now we move into the password. You can change the password, I'm just using an example here.
- Code:
-
cin>>pass;
if(pass == "ProgrammingThatWish")
{
Now, ProgrammingThatWish is the password.
Now, here is when you enter the password right, you'll get this message.
- Code:
-
cout<<"Password was correct! Welcome, to Programming Wish. Where you can program any kind of wish.";
}
else
{
Your message will be "Password was correct! Welcome, to Programming Wish. Where you can program any kind of wish" That's your message.
Now, lets move into where you enter the password, wrong.
- Code:
-
cout<<"Password is incorrect! Plase, don't try that.";
}
That's when you get the password wrong!
Now, you'll need this.
- Code:
-
system("PUASE>>NULL") ;
return 0;
}
That's the end of the whole script. Now, you should have this by now.
- Code:
-
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
string pass:
cout<<"Please enter the hidden password. Here's a hint. Program"<<endl;
cin>>pass;
if(pass == ProgrammingThatWish")
{
cout<<"Password was correct! Welcome, to Programming Wish. Where you can program any kind of wish.";
}
else
{
cout<<"Password is incorrect! Plase, don't try that.";
}
system("PUASE>>NULL") ;
return 0;
}
If not, fix it. If you have any questions, come and ask.
But for now, that's the end of it.