Question: Hi, this is my first C program and I really don't know how to do the first part which is too check if all arguments

Hi, this is my first C program and I really don't know how to do the first part which is too check if all arguments should be accepted.
Can you help me with that? Thanks!
Hi, this is my first C program and I really don't know
how to do the first part which is too check if all
I'm coding in C and using Linux

Total Points: 20 Ex. 1 - A Simple Interger Calculator (9 Points) In this exercise, you will create a C program to implement a simple integer calculator Your calculator should accept three arguments as input, x, op, y, where x and y are integers and op is one of the operators +, -, *, / to perform the corresponding arithmetic operations. 1. Use vi to create a C program source file simplecalc.c 2.(1 Point) The program should include a comment section at the beginning that describes its purpose (couple of lines), the author your name), your department, a small "history section indicating what changes you did on what date. Program to implement a simple calculator Author Dept. Date Notes * ** * * ******************************************** Joseph D Joseph D Comp. Science. Feb 10 2020 Comp. Science. Feb 11 2020 Initial version. Added error handling. The code should be properly indented for readability as well as contain any additional comments required to understand the program logic. 3. (1 Point) The source code should be compilable by (exactly) using the command gee -o simplecalc simplecalc.c 4.(3 Points) Your program should accept the three arguments mentioned above as its input. If the user does not pass this argument, you should display an error message and terminate with error code 1. $ ./simplecalc Error: usage is simplecalc $ echo $? 5.(4 Points) Your program performs simple arithmetic operations on the input as indicated by the operator and displays the output. You should use a switch statement to decide which operator to execute. You will loose 2 points if you do not use the switch. If the user enters one of the operators not listed above, print an error message and terminate with error code 2. Successfull execution of the program should result in a return code of O from the program $ ./simplecalc 5 + 3 $ echo $? $ ./simplecalc 5 - 3 $ /simplecalc 5 + 3 $ ./simplecalc 5 / 3 $ ./simplecalc 5 0 3 not a valid operator $ echo $

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!