Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cctype>
- #include <ctime>
- #include <functional>
- #include <iostream>
- #include <random>
- #include <string>
- #include <vector>
- #include <windows.h>
- void cls()
- {
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- COORD coordScreen = { 0, 0 };
- DWORD cCharsWritten;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- DWORD dwConSize;
- if( !GetConsoleScreenBufferInfo( hConsole, &csbi ))
- return;
- dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
- if( !FillConsoleOutputCharacter( hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten ) ||
- !GetConsoleScreenBufferInfo( hConsole, &csbi ) ||
- !FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten ))
- return;
- SetConsoleCursorPosition( hConsole, coordScreen );
- }
- int regis()
- {
- int user,pass;
- std::cout<<"\n\n\n Welcome to register section\n Please enter your UserName\n";
- std::cin>> user;
- std::cout<<" Enter your password\n";
- std::cin>>pass;
- cls();
- std::cout<<" Registration complete!\nNow please login in\n";
- int reg1;
- cls();
- std::cout<<"Hit 1 do start logging in\n";
- std::cin>>reg1;
- if(reg1==1)
- {
- cls();
- int user1,pass1;
- std::cout<<"Username:";
- std::cin>>user1;
- std::cout<<"Password::";
- std::cin>>pass1;
- if(user1==user && pass1==pass)
- {
- cls();
- std::cout<<"Login succesfull!";
- }
- else
- {
- cls;
- std::cout<<"Login failed";
- regis();
- }
- }
- else
- {
- cls();
- std::cout<<"You haven't entered 1, please try again\n";
- }
- }
- int main()
- {
- int reg;
- std::cout<<"\n\n\n Please register to enter on site(Press 1)\n";
- std::cin>>reg;
- if(reg==1)
- {
- cls();
- regis();
- }
- else
- {
- cls();
- std::cout<<"You haven't entered 1, please try again\n";
- main();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement