Help me pleasee?

I am trying to write a program but i have ran into a problem i need to save a sentence and output it into a text file and i can not seem to get it to work can someone please tell me what to do and give me a example?
i know this is wrong but these is what i want to do

char date;
out << "Enter date" <<endl;
cin >> date;

ofstream myfile;
myfile.open ("date.txt");
myfile << date
myfile.close();

but it always comes out the first word even when i try doing strings someone help?
Are you having the sentence being entered by the user? So where it says
cin >> date;??? If so you only get the first word because cin will only read in up until a space. So you need to use getline.

getline(cin, fname);
There are a few getline's I get them confused but I think this will solve your issue.
Please use code tags when you post it makes it so much more readable.
Let me know if the issue is fixed.
i go these down

cout <<"what address do you want to send these items to?" <<endl;
getline(cin, address);
cin.clear();

it lets me run the program but dosnt let me enter in a value
Try this funtion, also from iostream
cin.getline(table_of_chars,max_length_of_string)
Like it is skipping it when you are supposed to enter the value? try to throw a cin.get(); before the getline.
could someone please give a example using my info?
thanks everyone its solved now :D
Topic archived. No new replies allowed.