Question
Problem: Write a program that behaves as described below.If the first command-line argument after the program name (argv[1]) is --help, print the usage information for
Problem: Write a program that behaves as described below.If the first command-line argument after the program name (argv[1]) is --help, print the usage information for the program. If that argument is not --help, you are to expectargv[1]and subsequent arguments to be real numbers(C, integer, float, or double types)in formats acceptable to the sscanf()function of the C library or strings of ASCII chars that are not readable as real numbers. You are to read the numbers, count them and calculate the sum, minimum value, maximum value and average of those numbers, and if there are non-numbers write these to stdout as they are encountered, one per line. If there are no command-line arguments other than the program name(arc equals 1), print a suitable error message and the usage information. If no numbers are among the command line arguments, print a suitable error message and the usage information following the non-numeric arguments present. Naming: Your submitted file is to be named p2.c.Output: Your programs output must be to stdout and of one of the four formats following, assuming argc and argv are the usual parameters for main()and where
This must be written in C, not C++.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started