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

C assignment , 1. Create text a file with the name "myemail" that has a sin...

1. Create text a file with the name "myemail" that has a single line in it, consisting of your email address. Something like "[email protected]" (or your hotmail or gm

Change to palindrome, A palindrome is a string that reads the same from bot...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Write a program to act as an electronic safe, Write a program to act as an ...

Write a program to act as an electronic safe. If the correct code has been entered the program should display "Safe Open".  If an incorrect code is input it should display "Alarm"

Sort wars, Explain each of the algorithms in a way that would be understand...

Explain each of the algorithms in a way that would be understandable to an intelligent person who is not familiar with programming. You should not use any code (or even pseudo code

What is an explicit constructor, A conversion constructor declared with the...

A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to execute an implied conversion of types. Its purpose is reserved ex

Advanced features of c, We are now quite happy to use the basic mathematica...

We are now quite happy to use the basic mathematical expressions, however in engineering we use scientific functions i.e Sin , Cos  , ln etc . Within C we have the following functi

Create a programming system, Your task is to create a programming system fo...

Your task is to create a programming system for a ferry. The ferry transports passengers and vehicles (cars, busses, lorries and bicycles). The ferry has space for 200 passengers a

Constructor , What is constructor or ctor? need help

What is constructor or ctor? need help

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