0
what symbol is used in c++ to represent square(e.g the square of 3 is 9) and cube?
3 Answers
+ 2
There is no square or cube operator in C++. You have to use pow from math.h.
#include <iostream>
#include <math.h>
using namespace std;
int main(void) {
cout << pow(42.0, 2.0) << endl; //square
cout << pow(42.0, 3.0); //cube
return 0;
}
0
and what is for suare root?
0
sqrt() function