Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<conio.h>
- #include<string.h>
- #include<iostream.h>
- void main(){
- highvideo(); // Makes color's sexy as hell
- clrscr(); // You know it
- int pass_not_entered = 1; // Checks if password is entered or not
- char password[100]; // Stores the password temporarily
- int len = 0; // Current length of password
- cout<<" Username : coolgirl \n Password : "; // Print this once
- while( pass_not_entered == 1 ){
- char ch = getch(); // Gets the character
- if( ch == 13){ // Gets us out of here if its ENTER
- // ENTER is always 13
- password[len] = '\0'; // This tells it where to stop in the string
- pass_not_entered = 0; // Makes sure we break out of the loop
- }else if( ch == 8 ){ // Dunno if its backspace on your computer but for me it was backspace
- // Pretty much moves our pointer in the "string" back so that we can rewrite it :P
- len --;
- }else{
- // Enters the character to the
- // current place in string
- password[len] = ch;
- len++; // Increments the current pointer
- // This could be in one line ...
- // As password[len++] = ch;
- }
- clrscr(); // CLears the screen
- // Prints our pretty looking gui
- cout<<" Username : coolgirl \n Password : ";
- // Prints the appropiate number of stars
- for( int j = 0; j < len ; j++){
- cout<<"*";
- }
- }
- cout<<endl<<endl<<endl;
- // checks if u entered the right password
- if( strcmp("suja",password) == 0 ){
- cout<<"Right Password FRIEND";
- // Says yes you are right
- }else{
- cout<<"Wrong password BITCH";
- // Says no you are wrong
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement