0
How would I do exponent math with C++?
I can't figure out how to calculate exponents with C++
5 Respostas
+ 5
Use cmath libray
it find function(name is pow)to calculate expoents
example:
#include<iostream>
#include<cmath>
using namespace std;
int maim(){
int x=3;
int y=pow(x,2);
cout<<y;//output:9
+ 4
use loop
example:(calculate (5)^4=625)
int result,y=1;
for(int i=1;i<=4;++i)
y*=5;
cout<<y;//output:625
+ 3
welcome😇😇
0
Thanks so much!
0
Oh, I see! Thanks.