You are asked to develop a program to display an input paragraph in multiple lines based on the alignment mode one chooses. Make sure your main function is concise by using functions as appropriate. 1.Prompt the user to input a paragraph of texts.2.You are going to program to make surea.The number of characters (including space) in each row is not more than a fixed number (you can decide it, for example, 16, 24, or others. You can design this number as a parameter in a function and allow the user to choose it in the main function).b.A word cannot be split into two rows. This means that the last word will be shifted to the next row if it makes the total characters in this row surpass the size limit. 3.Ask the user to choose the display mode out of four choices: Left aligned; Right aligned; Center aligned; and Justify aligned. You must implement these alignment functions by yourself, although some basic string functions such as substr() and length() canbe used.4.Create a while loop in the main function to allow users to display the paragraph appropriately based on the alignment mode chosen. Please refer to the WORD software for the effects of different alignments.
So this is what i have so far in this project and running into a couple issues with the alignment properties and also confused on what he wants the while loop to do
thank you.
#include <iostream>
#include <iomanip>
#include <string>
usingnamespace std;
int main()
{
std::string paragraph;
std::cout<<" Please, enter a full paragraph: ";
std::getline (std::cin,paragraph);
int adjustment = 0;
cout << " Please give me a numerical number from 1 to 4 for how you would like your paragraph to be formatted " <<"\n"<<"1.Left aligned, 2.Right aligned, 3.Center aligned, 4.Justify aligned: ";
cin >> adjustment;
switch(adjustment)
{
case 1 :
std::cout.width(6); std::cout << left << paragraph << "\n";
break;
case 2 :
std::cout.width(6); std::cout<< right << paragraph << "\n";
break;
case 3 :
std::cout.width(6); std::cout<< setw(20)<< paragraph << "\n";
break;
case 4 :
std::cout.width(6); std::cout<< std::internal << paragraph << "\n";
break;
default :
cout<<"Please enter a number from only 1 to 4"<<endl;
}
return 0;
}