Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- string inputfilename, inputmessage, fromfile;
- fstream LAP;
- cout << "Enter file name: ";
- getline(cin,inputfilename);
- cout << "Please put your message: ";
- getline(cin,inputmessage);
- LAP.open(inputfilename.c_str(),ios::out);
- LAP << inputmessage;
- LAP.close();
- LAP.open(inputfilename.c_str(),ios::in);
- while(getline(LAP,fromfile))
- {
- cout << fromfile << endl;
- }
- LAP.close();
- }
Add Comment
Please, Sign In to add comment