hey sir,... i wana make a passward program but not getting how?/ would u like to help me plzz.... but that programming must b easy so i could easily understand .. bcoz m a begineeer of c language .. :/ ..
hey sir,... i wana make a passward program but not getting how?/ would u like to help me plzz.... but that programming must b easy so i could easily understand .. bcoz m a begineeer of c language .. :/ ..
Need a bit more information on what exactly you are trying to accomplish. Writing a simple program that would ask for a password before continuation would be something like:
This is simplistic of course, but like I said before it depends on what you are trying to accomplish.Code:#include <iostream> #include <string> using namespace std; int main() { string passwdOne; cout << "Please enter the password : "; getline(cin, passwdOne); if (passwdOne == "yourpasswordhere") { cout << endl << "stuff goes here" << endl; } return 0; }
I would probably change the line
code to comparing individual characters:Code:if (passwdOne == "yourpasswordhere") { cout << endl << "stuff goes here" << endl; }
Or something like this.Code:bool result; int size; size = passwdOne.length(); for( int x = 0; x < size; x++ ) { if( passwdOne[x] != passwdTwo[x] ) { result = false; break; } result = true; }
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.