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(); }