I am attempting to make a journal prog.

hello Im trying to make a program to help me keep up with my progress with a journal program, I want the program to store the information I input in the .txt document I have saved to my flash drive and save the date i input it. all i get it to do is save the first word not a full sentence or store the date it was typed just displays. BEWARE IM A NOOB AT PROGRAMMING.
THIS is what I have so far.

//5th program is a journal program... hope this works
#include <iostream>

#include <fstream>

#include <ctime>

using namespace std;

int
getMonth(time_t timeval)
{
struct tm * timeinfo;
timeinfo = localtime(&timeval);
return timeinfo->tm_mon + 1;
}
int
getDay(time_t timeval)
{
struct tm * timeinfo;
timeinfo = localtime(&timeval);
return timeinfo->tm_mday;
}
int
getYear(time_t timeval)
{
struct tm * timeinfo;
timeinfo = localtime(&timeval);
return timeinfo->tm_year+1900;
}

int main()
{
string j;

ofstream Cplusplusjournal;
Cplusplusjournal.open("I:\\cplusplusjournal\\journal.txt");
cin >> j;
Cplusplusjournal << j << endl;
cout << "\nThe Current Date Is:";

cout << getMonth(time(0)) << "/" << getDay(time(0)) << "/" << getYear(time(0));


cin>>a>>text>>name>>size

system("Pause");

}


Last edited on
Topic archived. No new replies allowed.