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

File, how i can open a file

how i can open a file

Program to print a series, Write a program called Series that will print/di...

Write a program called Series that will print/display a series of numbers starting with 1 and ending with the last number that is less than 30. The series should include only odd n

Operation on array - c program, Operation on array: void Array::add( O...

Operation on array: void Array::add( Object& toAdd ) {     lastElementIndex++;     while( ptrAt( lastElementIndex ) != ZERO &&            lastElementIndex

Described assignment operator?, Default assignment operator mange assigning...

Default assignment operator mange assigning one object to another object of the same class. It is member to member copy as shallow copy.

What are compound statements, What are compound statements? - Compound ...

What are compound statements? - Compound statements are made up of two or more program statements that are executed together. They may be executed with a loop. - Curly brack

What is the difference between = symbol and = = symbol, What is the differe...

What is the difference between = symbol and == symbol? - The = symbol is generally used in mathematical operations. It's used to assign a value to a given variable whereas the

C, Write a program to find the area under the curve y = f(x) between x = a ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

C++, how do i write a c++ program that will input a number and output its f...

how do i write a c++ program that will input a number and output its factorial using the while loop

Explain formatted input output with file pointer, Explain Formatted Input O...

Explain Formatted Input Output with File Pointer? Likewise there are equivalents to the functions scanf and printf which write or read data to files. These are called fscanf a

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