0

Should i have something incorrect ..if then plzz suggest me ! I want to made a calculator .

https://code.sololearn.com/cHUIdO36XeU8/?ref=app

21st Aug 2018, 6:47 AM
Abhishek kumar
Abhishek kumar - avatar
6 Respuestas
+ 2
:)
21st Aug 2018, 8:29 AM
Meet Mehta
Meet Mehta - avatar
+ 1
It is an simple example , you can make it more advance as per your requirements. If this helps☺️☺️. https://code.sololearn.com/coT5vS5enflE/?ref=app
21st Aug 2018, 7:43 AM
Meet Mehta
Meet Mehta - avatar
0
#include <iostream> using namespace std ; int sum(int a, int b) { return a+b ; } int sub(int c, int d) { return c-d ; } int mul(int e, int f) { return e*f ; } int divide(int g, int h) { return g/h; } int main () { int i; int j; cin>>i>>j; cout<<"Sum: "<<sum(i,j)<<endl; cout<<"Sub: "<<sub(i,j)<<endl; cout<<"Mul: "<<mul(i,j)<<endl; cout<<"Div: "<<divide(i,j)<<endl; return 0 ; } corrected your code a bit
21st Aug 2018, 7:06 AM
MarJan
MarJan - avatar
0
okay that's perfect . But I want to create that calculator that computes only one thing either sum/sub/div/mul .. so I want to promote the user of calculator to choose what he/she want to go for . pls sir give some advice :)
21st Aug 2018, 7:12 AM
Abhishek kumar
Abhishek kumar - avatar
0
you can make a user to write the expression e.g. 2+4 and use a char to store the + sign, then use a switch statement to check what symbol did the user enter
21st Aug 2018, 7:21 AM
MarJan
MarJan - avatar
0
thanks meet mehta
21st Aug 2018, 8:01 AM
Abhishek kumar
Abhishek kumar - avatar