fork download
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4.  
  5.  
  6. int main ()
  7. {
  8. string a;
  9. string user,user2 , new_user;
  10. cout << "Please Enter 1 to enter SignUp Screen..\n ";
  11. getline(cin, a, '\n');
  12. if (a == "1")
  13. {
  14. cout << "Enter your Username it should have a maximum limit of 8 characters\n " << endl;
  15. getline(cin, user, '\n');
  16. new_user = user;
  17. cout << "Your account is Created ! \n";
  18. }
  19. else
  20. {
  21. cout << "You entered number other then 1 \n";
  22. }
  23. cout << " Enter Username To Sign in \n ";
  24. getline(cin, user2, '\n');
  25.  
  26. if (user2 == new_user){
  27. cout << "Successful Login!! \n ";
  28. }
  29. else{
  30. int i=0;
  31. while (i < 4)
  32. {
  33. cout << " Enter Again Username To Sign in \n ";
  34. getline(cin, user2, '\n');
  35.  
  36. if(user2 == new_user)
  37. {
  38. cout << "Successful Login !\n";
  39. exit(0);
  40. return 0;
  41. }
  42. else{
  43. i++;}
  44. }
  45. cout << "Contact System Administrator ! ! ! \n " ;
  46. }
  47. exit(0);
  48. return 0;
  49. }
  50.  
Success #stdin #stdout 0s 3432KB
stdin
1
alba
alba
stdout
Please Enter 1 to enter SignUp Screen..
 Enter your Username  it should have a maximum limit of 8 characters
 
Your account is Created ! 
 Enter Username To Sign in 
 Successful Login!!