Guest User

Untitled

a guest
Dec 13th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <cstdlib>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string inputfilename, inputmessage, fromfile;
  10.  
  11. fstream LAP;
  12. cout << "Enter file name: ";
  13. getline(cin,inputfilename);
  14.  
  15. cout << "Please put your message: ";
  16. getline(cin,inputmessage);
  17.  
  18. LAP.open(inputfilename.c_str(),ios::out);
  19. LAP << inputmessage;
  20. LAP.close();
  21.  
  22. LAP.open(inputfilename.c_str(),ios::in);
  23. while(getline(LAP,fromfile))
  24. {
  25. cout << fromfile << endl;
  26. }
  27.  
  28. LAP.close();
  29. }
Add Comment
Please, Sign In to add comment