Write a c program as text layout, C/C++ Programming

Assignment Help:

Your task in this project is to write a C program named layout.c which does text layout. This is a staged project, complete the stages in order. The maximum mark if you nish each stage is shown in the header for each stage.

Stage A: Ragged Layout

Text layout is laying out a series of words, given a xed pagewidth, so that the words do not run over the length. Of course sometimes we have words that are longer than the line length and they simply have to placed on a line by themselves (even though this means the line is too long).

We provide a template for the project layout.c which contains some code to (a) handle the options for invoking the program, and (b) handle the input processing. The maximum pagewidth you need to handle in 100.

You should not change the procedure main in layout.c except in between the lines marked /* your code starts here */ and /* your code ends here */. and they should not be changed. The function get word is provided, you should not change it. get word returns the next word in the input as a string. It skips over whitespace, and returns a paragraph break, when there is a full line of whitespace, represented by the string "\n". It returns NULL when the end of input is reached. Some global variables at the top of the le are required for main and get word. They should not be changed.

The layout program is invoked for ragged layout as layout -r n where n is the pagewidth. It reads input from stdin and rights to stdout.

For example given the input le sample.txt containing:

The quick brown fox jumped over the lazy dog.


Related Discussions:- Write a c program as text layout

Stone game, how to write a c program for stone game

how to write a c program for stone game

Program is to perform all the functions of super bazaar, Program is to perf...

Program is to perform all the functions that are performed in a super bazaar: class stock   {   private:     int itno;     char itname[20];     char brname[20];

Radix, a popular joke among computer is to say............

a popular joke among computer is to say............

Explain the rules for overloading an operator, Rules for overloading an ope...

Rules for overloading an operator This summarizes the most significant points you need to know in order to do operator function overloading. The only operators you may o

Define the bitwise-exclusive-or operator, Define the Bitwise-Exclusive-OR O...

Define the Bitwise-Exclusive-OR Operator: ^: The bitwise-exclusive-OR operator (^) compares every bit of its first operand to the corresponding bit of its second operand. If on

C program to search for a given character in a string, Program is to search...

Program is to search for a given character in a string: Program is to search for a given character in a string and print point of match char *stsearch(char *string, char sea

Program to calculate average of marks, Program for calculate average of tot...

Program for calculate average of total marks: #include using namespace std; void print(int marks_arr[],int cnt) { int ind[cnt]; int i=0; int j=0; int k=0;

Game, how to make a game

how to make a game

Harcourt social studies, how would land elevation have changed if Coronado ...

how would land elevation have changed if Coronado had traveled 150 miles due west from what is today Arizona instead of east toward New Mexico

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd