Question: C++ - Write a code to make an arithmetic calculator For two command line argument(eg. 4 8), Your program must perform an addition operation, taking

C++ - Write a code to make an arithmetic calculator

For two command line argument(eg. 4 8), Your program must perform an addition operation, taking the first two arguments as the operands and display only the result to the console with a new line character. For situation where THREE command line arguments are passed to your program: If the third argument is 'a', your program must perform an addition operation, taking the first two arguments as the operands and display only the result to the console with a new line character.

Similarly, if the third argument is 's' it will perform subtraction, 'm' to perform multiplication, 'd' for division, 'p'- your program must perform an exponential operation, taking the first argument as the base operand and the second as exponent. the exponent operand.

Example: lab1_1234567.exe 10 2 s which should return 10 - 2 = 8, i.e. the last (and only) line on the console will be: 8 Example2: lab1_1234567.exe 10 2 d which should return 10 / 2 = 5, i.e. the last (and only) line on the console will be: 5

If the third input argument is not a valid operation selection(not a,s,m,d,p), the output shall be 'V'. Valid operators are ONLY (case sensitive). Also if the first two arguments are not valid decimal numbers, the output shall be 'X'. For example: 1.3, 3, .3 is valid and ABC123,1.3.4 is not valid.

LASTLY

DO NOT use 'cin' or gets() type functions. Do NOT ask for user input. All input MUST be specified on the command line separated by blank spaces (i.e. use the argv and argc input parameters).

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!