Guest User

Untitled

a guest
Mar 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. bool is_user = false,startDatabase = false;
  8. string file_text;
  9. string username;
  10. string password;
  11. string repeat_password;
  12. bool isCorrect = false;
  13.  
  14. int main(int argc, char const *argv[])
  15. {
  16. ofstream setText("user_data.txt");
  17.  
  18. ifstream getText("user_data.txt");
  19.  
  20. getText.getline(file_text,10);
  21. if(file_text == ""){
  22. while(!isCorrect){
  23. cout << "For using our dataBase, please enter data for
  24. privacy nUsername : ";
  25. cin >> username;
  26. cout << "Password : ";
  27. cin >> password;
  28. cout << "Repeat password : ";
  29. cin >> repeat_password;
  30. if(password == repeat_password){
  31. isCorrect = true;
  32. }else{
  33. cout << "Please, repeat and enter identistic passwords!";
  34. isCorrect = false;
  35. }
  36. }
  37.  
  38. setText << username << password;
  39. }else{
  40. int data_count_username = username.length();
  41. int data_count_password = password.length();
  42.  
  43. string pass_password;
  44. string pass_username;
  45.  
  46. cout << "Please enter your data " << endl << "Username : ";
  47. cin >> username;
  48. cout << "Password : ";
  49. cin >> password;
  50. getText.getline(pass_username,data_count_username);
  51. getText.getline(pass_password, data_count_password);
  52.  
  53. if(pass_username == username && pass_password == password){
  54. startDatabase = true;
  55. }
  56. }
  57.  
  58. setText.close();
  59. getText.close();
  60.  
  61. return 0;
  62. }
Add Comment
Please, Sign In to add comment