How i make a simple calculator which it take 15 number and operator in one time and show correct value in C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How i make a simple calculator which it take 15 number and operator in one time and show correct value in C++

C++

22nd Feb 2022, 3:02 AM
MR€NavidAhmad€AFG
MR€NavidAhmad€AFG - avatar
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.
22nd Feb 2022, 3:41 AM
Ipang
0
ok you say right, so how make it are you have this code
22nd Feb 2022, 4:31 AM
MR€NavidAhmad€AFG
MR€NavidAhmad€AFG - avatar
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
22nd Feb 2022, 5:01 AM
Raul Ramirez
Raul Ramirez - avatar