Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++, read the instructions carefully please. here is the first link: here is the 2nd here is the 3rd here is the last code

in c++, read the instructions carefully please.

image text in transcribed

here is the first link:

image text in transcribed

here is the 2nd

image text in transcribed

here is the 3rd

image text in transcribed

here is the last code

image text in transcribed

Strings, File I/O You are free to use a single or multiple files for this project. If you are putting all functions in a single file, make sure that more abstract functions are defined first. Text justification is spacing of the text block so that both right and left side of the text have a straight edge. This is accomplished by adding spaces so that every line is exactly the same length. You are to implement simplified justification rules as follows. Every line should be exactly 75 characters long (keep this value in a named constant). To get to this line length, extra space is first added after punctuation marks. You need to consider only these marks: .!?; That is, every punctuation mark may be followed by two spaces. If the spaces after punctuation marks are added and the line is still less than 75 characters, additional spaces are added after random words in the line. There is no need to ensure that the extra spaces are spread uniformly. Randomization is sufficient. A line that is shorter than 40 characters is considered the end of a paragraph is not justified. Hyphenation (breaking up of words) between lines is not required. 1. Line Justification. Study code folding in MSVS described here. As you work on the below project, demonstrate to the lab instructor code folding and unfolding. Createa project titled Lab7_LineJustify. Write a program that asks the user to input a string and then prints this string out in 75 characters according to the above justification rules. You may assume that the user always inputs the line that is less than 75 characters. Below is an example dialog: input line: Contrary to popular belief, Lorem Ipsum is not simply random text your 1ine justified: Contrary to popular belief, Lorem Ipsum is not simply random text Hints: Use getline function to get user input. See this example for its operation. To locate spaces and punctuation characters, consider this code. This code demonstrates how multiple occurrences of the same symbol may be found. String size) function determines the number of characters in a string. This code demonstrates string modification. To rand omly insert spaces, consider the following approach loop until the string is the right size locate the end of the next word obtain a random boolean value (conditional operator is useful here) if true insert space locate the beginning of the next word, if end of the string is reached, start from the begining of the string Use find first_of (white space characters) to locate end of next word, and find first not_of (white space characters) to locate the beginning of the next word #include #include using std: :cout; using std::cin; using std::endl; using std: :string; // prints statistics of staring void print stats(const string &); int main(){ string s; // string to measure the parameters o:f string guit="". // guit after this comparison? cout #include using std: :cout; using std: :endl; using std::cin; using std::string; void printresult (int); // printing result of search int main()f string quit="y". // quit after this loop? cout tosearch; cout > tofind; cout > quit; \while (quit !-"y"); void printresult (int result) if(result != string ::npos ) cout #include iostream using std: :cout; using std: :endl; using std::cin; using std: :string; int main()f string s- "baa baa black sheep"; int pos-s.find('a'); while (pos-string: :npos){ cout #include

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 International Workshops Gdm Benchmarx Mcis Snsmw Diew Udm Tsukuba Japan April 2010 Revised Selected Papers Lncs 6193

Authors: Masatoshi Yoshikawa ,Xiaofeng Meng ,Takayuki Yumoto ,Qiang Ma ,Lifeng Sun ,Chiemi Watanabe

2010th Edition

3642145884, 978-3642145889

More Books

Students also viewed these Databases questions

Question

Keep your head straight on your shoulders

Answered: 1 week ago