Question: c++ program that is a calculator. It must take command line arguments. The arguments are as follows: 1 optional arg -hexidecimal, default is decimal 1
c++ program that is a calculator. It must take command line arguments.
The arguments are as follows:
1 optional arg -hexidecimal, default is decimal
1 mandatory operator ( + - / *)
finally at least one digit (0123456789), but could also be many
Output:
the result of math. Example output is in bold below.
It should read the command line arguments from left to right like Ex: * 3 3
would be 3 * 3 = 9.
+ 2 2 2 2 2
would be 2 + 2 + 2 + 2 + 2 = 10.
- 1
would be -1.
+ 2
would be 2.
Example input:
./calc -hexidecimal - 20 4
10
./calc - 20 4
16
./calc + 2 2
4
./calc -hexidecimal 3
3
./calc / 100 2 25 2
1
No printf(), scanf(), fopen(), and getchar() allowed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
