A program that does the calculator using functions and uses any number specified by the user but at zero stops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A program that does the calculator using functions and uses any number specified by the user but at zero stops

for example 1+2+3...or 1×2×3... answer about my question please?

9th Oct 2017, 6:37 PM
Bts...
Bts... - avatar
3 Answers
+ 2
Post up your code and what errors you're getting; I'll be more than happy to help you figure out what you're doing wrong.
9th Oct 2017, 6:42 PM
AgentSmith
+ 1
You answered your own question. Set up some functions for your math, set up means to obtain input from user / use checks to test your conditions, if zero then stop program.
9th Oct 2017, 6:39 PM
AgentSmith
0
void addi(int a,int b) { cout<<a+b; } void mult (int a,int b) { cout<<a*b; } void subt(int a,int b) { cout<<a-b; } void divi (int a,int b) { cout<<a/b; } int main() { int x,y; char z; cout<<"enter your option "; cinn>>z; cout<<"enter your number"; cin>>x; cin>>y; if (z=='+') addi (x,y); else if(z=='*') mult (x,y); else if (z=='/') divi (x,y); else if (z=='-') subt (x,y); return 0; } without an introduction
9th Oct 2017, 6:55 PM
Bts...
Bts... - avatar