Question: Program Instructions: Write a program that performs simple math expressions on command line arguments. 1 . The program should take exactly 3 arguments and check
Program Instructions: Write a program that performs simple math expressions on command line arguments.
The program should take exactly arguments and check the number of arguments
Convert args and to numbers with atoi Note that atoi returns for errors; you can ignore this for now.
Check arg for valid math operations x with if or switch statements
Perform the correct math operation and print the results according to the sample output on the next page.
Format the printed output EXACTLY as in the sample output below including spacing and line skips If the number of arguments is wrong or the math symbol isnt recognized, print the word Usage and then some sensible usage instructions however for grading I'll only be checking that the first characters are Usage
Note that in the samples below, the $ represents the bash prompt and is printed automatically by bash. Dont print dollar signs from your C program. The first line shows what you type, the second and third lines are the output if done correctly.
Sample of correct usage and resulting output:
$ aout
$
$
Sample of incorrect usage no spaces between arguments which causes usage instructions to be printed
$ aout
$ Usage
$
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
