Question: Program in C - Your programs can not include any library header files other than stdio.h. Your programs can not call any C library functions
Program in C 
- Your programs can not include any library header files other than stdio.h.
Your programs can not call any C library functions other than printf(), scanf(), and feof().
-
2.1 The line length check program lengthwarning.c This program will check for lines in its input that are more than 80 characters. First, here are concepts and the terminology we use. A line is a sequence of zero or more characters terminated with the special newline character. The size of a line refers to the actual number of characters in the line (not including the newline character). The newline character indicates where the line ends, but it is not part of the line's contents, so it does not count towards its size. The length of a line refers to the number of spaces that the line occupies when printed. If a line has no tab characters its length equals its size. The length of a line that contains tab characters is described in Section 2.2 below. There will not be more than 1000 characters before the newline character of any input line. Your lengthwarning.c program needs to do the following: - Read one input line at a time and process it as described next. As each line is being read, store its characters into a one-dimensional array that is large enough to store just one input line, then process that one line. (Do not try to read and store all of the lines in the entire input at once, just read and process one line at a time.) - Determine the length of the line, either during or after reading the line. - For the line that was just read, print the following on one output line (with no spaces other than what are described): - In the first output column or character position print either a single blank space character if the length of the current line that was just read was 80 or less, or a single asterisk * if the line's length was more than 80. - Then print the current line's number, where the first line read is line \#1. Your program's input will never contain more than 99999 lines, so the line number should be printed in a field of exactly 5 places, padded on the left with blank spaces if it is less than 5 digits. (This can be done the hard way, but note that it is trivial to accomplish in C using printf() formatting options that were explained in a recent discussion section.) - Then print a colon, a single blank space, all the characters of the line that was read, and a newline. (The actual input line as printed will always begin in the ninth column or output line position, because the space or asterisk, line number, colon, and following space occupy the first eight positions.) - An additional line of output is to be printed only for input lines whose length are longer than 80 . Immediately following the line that was read and printed, a second line must be printed that has exactly 88 blank spaces, then enough caret characters () so there is a caret underneath each character of the line that would be beyond length 80. See the example below. (88 blank spaces includes 80 for the characters of the line that are within the first 80 positions, plus as mentioned 8 for the asterisk or space, line number, colon, and space.) - Do this for all lines in the input, until the end of the input is reached. This program's input could be anything- it doesn't even have to be a C program. But if you run it reading its own code, it will tell you whether it has any lines longer than 80 characters, which you would lose credit for during grading. Here is an example of the output that should be produced for a single input line exactly 85 characters long, with blank spaces shown as _.. The public test outputs have more examples of the expected output format, so look at all of the public test inputs and their expected outputs (discussed below) before starting to code. Note that lines can't just be printed as they are being read, because when a line whose length is greater than 80 is printed, an asterisk has to be printed first. So an entire line must be read so its length can first be determined, only then can it be printed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
