Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.12 KB | None | 0 0
  1. #include <cctype>
  2. #include <ctime>
  3. #include <functional>
  4. #include <iostream>
  5. #include <random>
  6. #include <string>
  7. #include <vector>
  8. #include <windows.h>
  9.  
  10. void cls()
  11. {
  12.     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  13.     COORD coordScreen = { 0, 0 };
  14.     DWORD cCharsWritten;
  15.     CONSOLE_SCREEN_BUFFER_INFO csbi;
  16.     DWORD dwConSize;
  17.     if( !GetConsoleScreenBufferInfo( hConsole, &csbi ))
  18.         return;
  19.     dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
  20.     if( !FillConsoleOutputCharacter( hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten ) ||
  21.             !GetConsoleScreenBufferInfo( hConsole, &csbi ) ||
  22.             !FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten ))
  23.         return;
  24.     SetConsoleCursorPosition( hConsole, coordScreen );
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31. int regis()
  32. {
  33.  
  34.     int user,pass;
  35.  
  36.     std::cout<<"\n\n\n    Welcome to register section\n    Please enter your UserName\n";
  37.  
  38.     std::cin>> user;
  39.  
  40.     std::cout<<"    Enter your password\n";
  41.  
  42.     std::cin>>pass;
  43.  
  44.     cls();
  45.  
  46.     std::cout<<"    Registration complete!\nNow please login in\n";
  47.  
  48.     int reg1;
  49.  
  50.     cls();
  51.  
  52.     std::cout<<"Hit 1 do start logging in\n";
  53.  
  54.     std::cin>>reg1;
  55.  
  56.     if(reg1==1)
  57.     {
  58.         cls();
  59.  
  60.  
  61.         int user1,pass1;
  62.  
  63.         std::cout<<"Username:";
  64.  
  65.         std::cin>>user1;
  66.  
  67.         std::cout<<"Password::";
  68.  
  69.         std::cin>>pass1;
  70.  
  71.  
  72.         if(user1==user && pass1==pass)
  73.         {
  74.             cls();
  75.             std::cout<<"Login succesfull!";
  76.         }
  77.         else
  78.         {
  79.             cls;
  80.             std::cout<<"Login failed";
  81.             regis();
  82.  
  83.         }
  84.  
  85.  
  86.  
  87.     }
  88.     else
  89.     {
  90.  
  91.         cls();
  92.         std::cout<<"You haven't entered 1, please try again\n";
  93.  
  94.  
  95.     }
  96.  
  97. }
  98. int main()
  99.  
  100. {
  101.     int reg;
  102.  
  103.     std::cout<<"\n\n\n      Please register to enter on site(Press 1)\n";
  104.  
  105.     std::cin>>reg;
  106.  
  107.     if(reg==1)
  108.     {
  109.         cls();
  110.         regis();
  111.  
  112.     }
  113.     else
  114.     {
  115.  
  116.         cls();
  117.         std::cout<<"You haven't entered 1, please try again\n";
  118.         main();
  119.  
  120.     }
  121.  
  122.  
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement