0

Whats wrong with my code. The expo function is acting up???¿

#include <iostream> using namespace std; void times(int x, int y){ int m; m = x*y; cout<<"Product:"<<m; cout<<endl; }/*declaration of a multiplication function*/ void expo(int e, int f){ int v= e**f; cout<<"Result:"<<v; cout<<endl; } int main() { cout<<"Welcome to Tymply"<<endl; cout<<"Input two values to multiply.."<<endl; cout<<"value_1;"<<endl; int a; cin>>a; cout<<"value_2;"<<endl; int b; cin>>b; cout<<endl; times(a,b);//calling the times()function cout<<"Exponention"<<endl; cout<<"Input the power:"<<endl; int r; cin>>r; cout<<"Input the base_number"<<endl; int t; cin>>t; expo(r,t) return 0; }

31st Jul 2020, 10:40 PM
MÆŘEÁLT
MÆŘEÁLT - avatar
1 Resposta
+ 1
MÆŘEÁLT Are you trying to calculate value of <e> raised to the power of <f>? In that case `pow()` function from <cmath> header be what you were looking for. http://www.cplusplus.com/reference/cmath/pow/
1st Aug 2020, 5:09 AM
Ipang