#include <iostream>
#include <fstream>
#include <ctime>
usingnamespace std;
int main ()
{time_t t = time(0);
struct tm * now = localtime( & t );
string entry;
ofstream myfile ("Journal.txt");
if (myfile.is_open())
{
cout << "Enter todays journal entry" << endl;
cin >> entry;
myfile << (now->tm_year + 1900) << '-'
<< (now->tm_mon + 1) << '-'
<< now->tm_mday
<< endl;
myfile << entry <<endl;
myfile.close();
}
else cout << "Unable to open file";
system ("pause");
}
So Im making journal. This here is what I have so far. The problem is that the program only writes 1 word and overwrites the previous entry. I need alittle help and guidance for this. Im 11 so keep it as simple as possible. TY