Advertisement
Guest User

hm

a guest
Apr 4th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <fstream>
  4. #include <Windows.h>
  5. #include <string>
  6. #pragma warning( disable : 4996)
  7. using namespace std;
  8. int get_file_size(std::string file) // path to file
  9. {
  10. FILE *p_file = NULL;
  11. p_file = fopen(file.c_str(), "rb");
  12. fseek(p_file, 0, SEEK_END);
  13. int size = ftell(p_file);
  14. fclose(p_file);
  15. return size;
  16. }
  17. std::string username;
  18. std::string password;
  19. std::string buffer;
  20. std::ofstream outfile("username.txt");
  21. std::ifstream input("username.txt");
  22. int main() {
  23.  
  24. while (std::getline(input, buffer))
  25. username += (buffer + '\n');
  26. while (std::getline(input, buffer))
  27. password += (buffer + '\n');
  28.  
  29. string inputuser;
  30. string inputpass;
  31. cout << "Username: ";
  32. getline(cin, inputuser);
  33.  
  34. if (inputuser == username)
  35. {
  36. cout << "Password: ";
  37. getline(cin, inputpass);
  38. if (inputpass == password){ cout << "Welcome Fellow Block gamer";}
  39. else { cout << "Incorrect Password"; Sleep(500); }
  40. }
  41. else{ cout << "Incorrect Username"; Sleep(500);}
  42. }
  43.  
  44. std::ifstream::pos_type filesize(const char * filename)
  45. {
  46. return std::ifstream::pos_type();
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement