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

Introduction of c, Discuss the saleint featuresand application of c

Discuss the saleint featuresand application of c

C++ programming, give a program to accept and print 2_D Array

give a program to accept and print 2_D Array

Can i employ realloc() on pointers allocated through new?, A: No.       ...

A: No.       While realloc() need to copy the allocation, this uses a bitwise copy operation, that will tear several C++ objects to shreds. C++ objects must be allowed to copy t

Structure of cpp program, Structure of C++ Program: Chronological orde...

Structure of C++ Program: Chronological order of C++ program. 1.   Class declaration 2.   Main function program 3.   Member functions definitions 4.   Include heade

C++, #include long BixFunction(int x, int y = 5, float z = 5) { return...

#include long BixFunction(int x, int y = 5, float z = 5) { return(++x * ++y + (int)++z); } int main() { cout return 0; }

Flowchart, should i put define constant and memory constant in my flowchart...

should i put define constant and memory constant in my flowchart? the other one, how to draw flowchart for break and continue statement?

Define static storage class - computer programming, Define Static Storage C...

Define Static Storage Class in C Programming? The Static declarations have distinct and important uses. This allows the local variable to keep its previous value when the block

When i develop a destructor, When I develop a destructor, do I require to e...

When I develop a destructor, do I require to explicitly call the destructors for my member objects?

Define the classification of operators in c language, Define the Classifica...

Define the Classification of Operators in C Language? Depending on the function performed the operator can be classified as 1. Arithmetic Operator 2. Logical Operator 3. Inc

Draw a circle in c program , Draw a circle in c program: void main() ...

Draw a circle in c program: void main() { clrscr(); int i,r=50,t,j,x,y; int gd,gm; gd =DETECT; initgraph(&gd,&gm,""); for(x=50;x for(y=50;y {   i

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