your task in this project is to write a c program


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.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: your task in this project is to write a c program
Reference No:- TGS0276303

Expected delivery within 24 Hours