Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. john 123
  2. jim 89
  3. britney 852
  4.  
  5. john 123
  6. jim 89
  7. britney 852
  8. britney 852
  9.  
  10. #include <iostream>
  11. #include <fstream>
  12. #include <string>
  13. using namespace std;
  14. int main()
  15. {
  16. string passwd;
  17. string usern;
  18. string password;
  19. string username;
  20. ifstream infile;
  21. string line;
  22. infile.open("sample.txt");
  23. if(!infile)
  24. {
  25. cerr << "error during opening of the file" << endl;
  26. }
  27. else
  28. {
  29. while (!infile.eof())
  30. {
  31. infile >> usern >> passwd ;
  32. cout << usern << " " << passwd << endl;
  33. }
  34. }
  35. cout << "Enter user name : ";
  36. cin >> username;
  37. if (usern == username)
  38. {
  39. cout << "already exist" << endl;
  40. }
  41. infile.close();
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement