Question: How would you implement this algorithm into C++? Using : int main(int argc, char* argv[ ]) The program is instructed as to which options it

How would you implement this algorithm into C++?

Using :

int main(int argc, char* argv[ ])

How would you implement this algorithm into C++? Using : int main(int

The program is instructed as to which options it should use by way of command line arguments. Command line argument Meaning The output line length should be set to n. The value of n must be a positive integer greater than 0 -LL=n -IN=n The indentation should be set to n. The value of n must be a positive integer greater than 0 filename Name of the file to be opened and read for input. A filename cannot begin with a dash. If no filename is provided, the program should read from the standard input. You are allowed to have multiple-LL and -IN flag arguments. If you do, the last one specified is used. So, for example, providing the command line arguments "-LL=5 -LL=20-LL=100" results in a line length of 100. The following error cases must be checked and handled: Error case How it is handled More than one filename provided Unable to open file Print "TOO MANY FILENAMES" and stop Print "UNABLE TO OPEN FILE filename" and stop - Print "UNRECOGNIZED FLAG flag", and stop Unrecognized flag argument (a flag argument is an argument that begins with a dash) -LL or -IN flag does not have = after LL or IN S -LL-n or -IN=n and n is not a positive integer greater than 0 Print "MISSING = SIGN flag" and stop Print "VALUE NOT INTEGER > O flag" and stop - A

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!