basically im quite new to programming but i wanted to know how to do exponents. where someone can put in a first number and a second number. the answer would be the first number ^ second number.
i tried writing it as <<firstNumber<<"^"<<secondNumber<<"="<<(firstNumber^secondNumber)<< endl;
but it didnt seem to work... any suggesstions on how to do it???
It will be where:
You may be able to tell the compiler to use the C++11 standard.
From the code::blocks menu, select settings->compiler then click the checkbox for C++11.
Or, instead of using cbrt(), use raise the number to the power 1/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include <cmath>
usingnamespace std;
int main()
{
double num = 125;
double a = pow(num,1.0/3.0);
double b = cbrt(num);
cout << "num: " << num << " a: " << a << " b: " << b << endl;
return 0;
}