PDA

View Full Version : [C++] potenze


theberto
08-06-2010, 14:03
come posso elevare una variabile reale ad un'altra variabile reale tutte e due di tipo double?
grazie

fero86
08-06-2010, 15:53
con la funzione pow: http://www.cplusplus.com/reference/clibrary/cmath/pow/

fero86
08-06-2010, 15:55
esempio:

#include <iostream>
#include <cmath>
using namespace std;

int main() {
double a, b;
cin >> a >> b;
cout << pow(a, b) << endl;
return 0;
}

theberto
09-06-2010, 15:53
grazie a tutti