#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
cout<< "Please enter your password";
char password
char admin
cin>> password ;
if (password == admin)
cout<<"Hello admin";
else
cout<<"ERROR_REPORT WRONG PASSWORD" ;
system ("pause")
return 0;
}
5 Replies - 1016 Views - Last Post: 04 March 2012 - 04:23 PM
#1
I am trying to write a password login for cmd with c++
Posted 04 March 2012 - 01:39 PM
hi im new to c++ and am trying to make a lock for my cmd. when i type in my password it skips the if and goes to the else. idk what im doing wrong plz help. oh and im using bloodshed dev c++. and i havent added system ("cmd.exe") to the if part yet because it doesnt compile rite for some reason.
Replies To: I am trying to write a password login for cmd with c++
#2
Re: I am trying to write a password login for cmd with c++
Posted 04 March 2012 - 02:00 PM
password and admin need to be strings not chars. You'll also need to include the string header file and to assign the correct password to admin.
You're also missing two ';' on lines 9 and 10.
You're also missing two ';' on lines 9 and 10.
#3
Re: I am trying to write a password login for cmd with c++
Posted 04 March 2012 - 03:52 PM
thx very much it worked!
#4
Re: I am trying to write a password login for cmd with c++
Posted 04 March 2012 - 04:04 PM
hi im am newto c++ and wondering if there is away to set a string so it will be permanent and wont be able to change it the next time you open the app. thx
#5
Re: I am trying to write a password login for cmd with c++
Posted 04 March 2012 - 04:17 PM
Merged duplicate topics. Don't create a new topic on a problem you've already posted about.
#6
Re: I am trying to write a password login for cmd with c++
Posted 04 March 2012 - 04:23 PM
Like this?
const string s = "hello";
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|