Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program that takes input from user if no filename is entered. The program is instructed as to which options it should use by way

C++ program that takes input from user if no filename is entered.

image text in transcribed

The program is instructed as to which options it should use by way of command line arguments. Command line argument Meaning -LL:n The output line length should be set to n. The value of n must be a positive integer greater than 0 -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 "-LL5-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 Print "TOO MANY FILENAMES" and stop Unable to open file Print "UNABLE TO OPEN FILE filename" and stop Unrecognized flag argument (a flag argument Print "UNRECOGNIZED FLAG flag", and stop is an argument that begins with a dash) -LL or -IN flag does not have = after LL or IN Print "MISSING = SIGN flag" and stop -LL=n or -IN=n and n is not a positive integer greater than 0 Print "VALUE NOT INTEGER > O flag" and stop The program is instructed as to which options it should use by way of command line arguments. Command line argument Meaning -LL:n The output line length should be set to n. The value of n must be a positive integer greater than 0 -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 "-LL5-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 Print "TOO MANY FILENAMES" and stop Unable to open file Print "UNABLE TO OPEN FILE filename" and stop Unrecognized flag argument (a flag argument Print "UNRECOGNIZED FLAG flag", and stop is an argument that begins with a dash) -LL or -IN flag does not have = after LL or IN Print "MISSING = SIGN flag" and stop -LL=n or -IN=n and n is not a positive integer greater than 0 Print "VALUE NOT INTEGER > O flag" and stop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

Explain budgetary Control

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago