how can i work with paragraph ?

hello
i have a small program consisting on getting a paragraph from a user
storing this paragraph in a text or word file if possible.
than to read back the paragraph from the text or word file.

1:
is it possible that a user write a long paragraph of about 2 or 3 pages in data type "string"? or is there any other data type to use ?

2:
how can i get the paragraph entered by the user and to store it in a text or word file?

3:
how can i read the paragraph from the text or word file the we created?

Thank you
closed account (Dy7SLyTq)
to 1) i dont know but i would use an array of strings to hold each line or a vector of strings

2-3) both are in the fstream header

http://www.cplusplus.com/reference/fstream/fstream/
http://www.cplusplus.com/reference/vector/vector/
Thank you, i will check the links you told me about and let you know if it will work :)
I would go with vector<string>vec to store each line, then you will neeed to include fstream to write what you store to a file. Just like DTS code said
You don't need a vector. Strings can hold newline characters without any issues.
closed account (Dy7SLyTq)
yes they can, but it makes it easier with vectors.
yes they can, but it makes it easier with vectors.

That's only true if the OP has any requirement to access or modify a single line, independently from the rest of the paragraph.

Nothing in the OP's post indicates that this might be the case.
Topic archived. No new replies allowed.