saira12tabassum19

Untitled

Aug 6th, 2020
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. void Log_In()
  2. {
  3. while(1)
  4. {
  5. int u,p;
  6. system("cls");
  7. Intro();
  8.  
  9. if(p==1&&u==1)
  10. cout<<"\n\n\t\t\t\tWrong username and password!! ,Try again"<<endl;
  11. else if(u==1)
  12. cout<<"\n\n\t\t\t\tWrong username!! ,Try again"<<endl;
  13. else if(p==1)
  14. {
  15. cout<<"\n\n\t\t\t\tWrong password!! ,Try again"<<endl;
  16. }
  17. u=0,p=0;
  18.  
  19. string user_name,password,user="",pass="";
  20. cout<<"\n\n\t\t\t\tUsername:";
  21. cin>>user_name;
  22. cout<<"\n\n\t\t\t\tPassword:";
  23. cin>>password;
  24.  
  25.  
  26. fstream new_file1,new_file2;
  27. new_file1.open("username.txt",ios::in);
  28. new_file2.open("password.txt",ios::in);
  29.  
  30. char a,b;
  31. while(!new_file1.fail())
  32. {
  33. new_file1>>a;
  34. if (new_file1.eof())
  35. {
  36. break;
  37. }
  38. user+=a;
  39. }
  40.  
  41.  
  42. while(!new_file2.fail())
  43. {
  44. new_file2>>b;
  45. if (new_file2.eof())
  46. {
  47. break;
  48. }
  49. pass+=b;
  50.  
  51. }
  52.  
  53.  
  54.  
  55. if(user==user_name&&pass==password)
  56. {
  57. system("cls");
  58. cout<<"\n\n\n\n\t\t\t\tWelcome to Bus management system";
  59. for(int i=0; i<=7; i++)
  60. {
  61. break_t(125);
  62. cout<<".";
  63. }
  64. break;
  65.  
  66. }
  67. else
  68. {
  69. if(user!=user_name)
  70. u=1;
  71. if(pass!=password)
  72. p=1;
  73.  
  74. }
  75.  
  76. }
  77. }
  78.  
Add Comment
Please, Sign In to add comment