#include <iostream>
#include <string>
#include <fstream>
usingnamespace std;
int main()
{
//ofstream
ofstream fileController;
string fileName;
cout << "Enter the file you would like to write to: ";
cin >> fileName;
fileController.open(fileName, ios::app);
string inputText;
cout << "Input for as long as you want, type end to quit." << endl;
while (inputText != "end")
{
getline(cin, inputText);
if (inputText != "end")
{
fileController << inputText << endl;
}
}
fileController.close();
ifstream fileInput;
cout << "\n\nEnter the file you would like to read to: ";
cin >> fileName;
fileInput.open(fileName);
fileInput.seekg(ios::beg);
string textOutput;
while (!fileInput.eof())
{
getline(fileInput, textOutput);
cout << textOutput << endl;
}
cin.get();
cin.get();
fileInput.close();
}