+ 1

Can Anyone Solve This Program error? and extend this coding to add more functions like trigonometry and scientific functions

Can Anyone Solve This Program error? and extend this coding to add more functions like trigonometry and scientific functions (factorial,power,square,sin,cos,tan) #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; int fact (int num) { if (num==1) { return 1; } else { return num*fact(num-1); } }; class Calculator { char x[1],y[0],z[0]; int a,b; public: void set(char x[0] , char z[0]); int sum() { return a+b;} int diff() { return a-b;} int prod() { return a*b;} float quod() { return a/b;} int perm () { return (fact (a)/fact (a-b));} int comb() { return (perm()/fact(b));} void get(char y[0]); void Calculator::set(char x[0] , char z[0]) {a=atoi (x); b=atoi (z); } }; void Calculator ::get(char y[0]) { if (y [0] =='+') { cout<<"sum"<<sum(); } else if (y[0]=='-') { cout<<"difference="<<diff(); } else if (y[0]=='*') { cout<<"Product="<<prod(); } else if (y[0]=='/') { cout<<"quotient="<<quod(); } else if (y[0]=='P'||y[0]=='P') { cout<<"Permutation="<<perm(); } else if (y[0]=='C'||y[0]=='C') { cout<<"Combination="<<comb(); } else { cout<<"invalid operator TRY AGAIN LATER"; } } int main() { char x[1],y[1],z[1]; cin>>x[0]>>y[0]>>z[0]; Calculator C; C.set(x,z); C.get (y); getch(); }

5th Dec 2017, 12:49 PM
Dark soul
Dark soul - avatar
1 ответ
Актуальное сегодня
What?
0 Votes
HTML
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
help
0 Votes
AI
2 Votes
APIs
1 Votes
Create Agent
0 Votes