Question: Please do this in C. Objectives Practice taking program arguments Practice using C libraries and functions Practice converting strings to integers Practice manipulating C strings
Please do this in C.




Objectives Practice taking program arguments Practice using C libraries and functions Practice converting strings to integers Practice manipulating C strings Practice top-down program design and reading pseudocode Overview For this lab, you will write a program that reads N lines of data from the terminal, one entire line at a time, and reverses the words of each line. In this example, N J1 /lab6 1 the quick brown fox jumps over the lazy dog dog lazy the over jumps fox brown quick th N is a number provided via a command-ine argument -details below. Details Requirements Take in a single command-line argument--this is how many lines of input the user will enter. o Print an error message if not enough or too many program arguments o Convert this argument to an integer (print error and quit if user entered less than 0) Do the following N times o Get an entire line of user input using fgets and store it in array o Using a function you implement yourself, reverse the words in the array The words must appear in reverse order, but still readable from left to right. (That is the characters in each word are still in their original order.) For example, "I pet the dog" becomes "dog the pet l The input strings will not have any puncuation, and will have exactly one space between each word. o Print out the reversed array Command-line arguments Command-line arguments are a way for you to provide input to the program at the moment it is executed. They follow the name of the program when you call it, for example ./my Program somevalue someotherValue This passes in "somevalue" and "someotherValue" to myProgram as command line arguments. To access and use these command line arguments, we're going to change the declaration of our main method to the following: int main( int argc, char argv
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
