Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Log_In()
- {
- while(1)
- {
- int u,p;
- system("cls");
- Intro();
- if(p==1&&u==1)
- cout<<"\n\n\t\t\t\tWrong username and password!! ,Try again"<<endl;
- else if(u==1)
- cout<<"\n\n\t\t\t\tWrong username!! ,Try again"<<endl;
- else if(p==1)
- {
- cout<<"\n\n\t\t\t\tWrong password!! ,Try again"<<endl;
- }
- u=0,p=0;
- string user_name,password,user="",pass="";
- cout<<"\n\n\t\t\t\tUsername:";
- cin>>user_name;
- cout<<"\n\n\t\t\t\tPassword:";
- cin>>password;
- fstream new_file1,new_file2;
- new_file1.open("username.txt",ios::in);
- new_file2.open("password.txt",ios::in);
- char a,b;
- while(!new_file1.fail())
- {
- new_file1>>a;
- if (new_file1.eof())
- {
- break;
- }
- user+=a;
- }
- while(!new_file2.fail())
- {
- new_file2>>b;
- if (new_file2.eof())
- {
- break;
- }
- pass+=b;
- }
- if(user==user_name&&pass==password)
- {
- system("cls");
- cout<<"\n\n\n\n\t\t\t\tWelcome to Bus management system";
- for(int i=0; i<=7; i++)
- {
- break_t(125);
- cout<<".";
- }
- break;
- }
- else
- {
- if(user!=user_name)
- u=1;
- if(pass!=password)
- p=1;
- }
- }
- }
Add Comment
Please, Sign In to add comment