Quote:Original post by Omid Ghavami
cout << n << "^3" << " = " << Cubed;
Or
cout << n << "^3 = " << Cubed;
Is that same thing a little shorter [smile]. But thats nitpicky.
At chockydavid1983,
In general dont use pow for such a trivial operation, the reason being is that pow is intended to calculate the power for arbitrary or large indices
So like pow(n, 313) for example, or if the user had to enter the power then you wouldnt know what its going to be before-hand.
If you just want to cube a number its more efficient to just multiply it by itself twice:
float Cubed = n * n * n;
Edit: Ah...just the read the bottom of your top post [grin]