Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. bool login(char username[], char password[])
  5. {
  6. cout << "\t\t Please login into the account\n";
  7. char * TMP_user_name = (char*)malloc(sizeof(char) * 20);
  8. char * TMP_password = (char*)malloc(sizeof(char) * 20);
  9.  
  10. cout << "username:";
  11. cin >> TMP_user_name;
  12.  
  13. cout << "password:";
  14. cin >> TMP_password;
  15.  
  16. if (strcmp(username, TMP_user_name) && strcmp(password, TMP_password))
  17. {
  18. return false;
  19. }
  20. else {
  21. return true;
  22. }
  23. }
  24.  
  25.  
  26. int main()
  27. {
  28. const int size = 20;
  29. char username[size];
  30. char password[size] ;
  31. char mail[size];
  32.  
  33. cout << "Enter your username :";
  34. cin >> username;
  35. cout << "Enter password :";
  36. cin >>password;
  37. cout << "Enter mail :";
  38. cin >> mail;
  39.  
  40. if (login(username, password))
  41. {
  42. cout << "You logged in succsessfuly" << endl;
  43. }
  44. else {
  45. cout << "Wrong password or username";
  46. }
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. cin.get();
  58. cin.get();
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement