- 1
How i make a simple calculator which it take 15 number and operator in one time and show correct value in C++
C++
3 Answers
0
Can't say it's a simple calculator though. There are things to consider, for example, operator precedence, which defines which sub-expression was to be evaluated prior to the others.
0
ok you say right, so how make it are you have this code
0
Step 1 get 15 numbers into a vector int
Step 2 get operation into a char
Step 3 make a function for each operation that takes in a vector and does said operation and returns the value
Ex
int getSum(vector<int> v ){
Sum = 0;
for(int i = 0; i < v.size();i++)
Sum += v[i]
Return sum
}
Step 4: if else if else statements