I need to write a C++ program that performs a basic arithmetic operations
including addition, subtraction, multiplication, and division.
The expressions are provided an input file and your calculator is supposed to read them from there and perform the calculation.
the input .txt file has this:
109.5 + 1.0
25 / 2
25.5 / 2
0 / 0
8 * 8
10 - 10
100 - 1
10 * -10
10.5 + 1000
1000 - 1.05
1000 * 1000
1000 / 1000
1000 / 0
I have no idea what to do. Can anyone help?
edit: I also need it to not allow division by zero
Last edited on
When I am unsure how to get a program started, I try to answer the following questions in order:
1. What does the program need to output?
2. What data is needed to generate this output?
3. How can the output be calculated from the given data?
So, I start by writing the code for the output first. For any unknown values required in the output, I use variables.