Hi guys, I need help writing a program that formats a paragraph from user-inputted words. The user should be allowed to input the desired width of the paragraph (10-70 characters) and have the option of having the paragraph boxed (optional) and centered (optional).
By creating a string variable that will contain the complete, formatted, paragraph. Using a loop to input words from the keyboard and append them to this string. Use the string length().
I'm having trouble manipulating length(), string::length.
I can't use simple input output like
1 2 3
|
char string::length;
cout << "Enter the desired width for your paragraph: " << endl;
cin >> string::length
|
Sample dialogue should look something like this:
Enter the desired width for your paragraph: 70
Do you want the paragraph boxed? yes
Do you want the box centered? yes
Enter paragraph ending with "endtext"
I hear there's rumors on the Internets that we're going to have a draft.
Rarely is the question asked: Is our children learning?
They misunderestimated me. endtext
Your paragraph follows:
+------------------------------------------------------------------------------+
|I hear there's rumors on the Internets that we're going to have a draft. |
|Rarely is the question asked: Is our children learning? |
|They misunderestimated me. |
+------------------------------------------------------------------------------+
|
Where the bold parts are user input and can be changed.
I've checked out reference and documentation but can't find anything that describes manipulating string::length through input.
If someone could just point me in the right direction...