Question: 2. (40 points) Write a program that accepts as command line arguments the sign of a math operation (+,-, x, or /) and two integer

2. (40 points) Write a program that accepts as command line arguments the sign of a math operation (+,-, x, or /) and two integer numbers and displays the result of the operation (all integer operations).

For example, if the arguments are +,5,-3, the program should display 2. You may find strcmp function useful. Note: x for the multiplication is letter x, not *. (* has special meaning to Unix shell.)

Sample run:

./a.out - 5 2

output: 3

1)Name your program command_math.c.

2)Use atoi function in to convert a string to integer form.

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!