Advertisement
Mastercpp

login

Sep 15th, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. #define USER "tito"
  5. #define pass "lol"
  6. using namespace std;
  7.  
  8. int main(){
  9.    
  10.    
  11.     string usuario ="",pss="";
  12.     char caracter;
  13.     int intentos = 3;
  14.     for(int i =1; i<=intentos; i++){
  15.         cout << "USUARIO: ";
  16.         cin>>usuario;
  17.         cout << "\nContrasena: ";
  18.         caracter = getch();
  19.         while(caracter != 13){
  20.             pss.push_back(caracter);
  21.             cout << "*";
  22.             caracter = getch();
  23.         }
  24.        
  25.         if(usuario == USER && pss == pass){
  26.             cout << "\n\nBienvenido " << USER << " A la fiesta de la imaginacion"<< endl;
  27.             intentos=0;
  28.         }
  29.         else{
  30.             cout << "\n\n Usuario y/o Contrase?a  no validos\ningrese los datos correctamente" << endl;
  31.         }
  32.     }
  33.    
  34.    
  35.    
  36.    
  37.     cin.get();
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement