1. ## Exponents??

Pardon the "n00b" question, but if there's a sqrt() function in [itex] then why the heck doesn't
Code:
`std::cout<<i^2;`
give me i squared? (I know, ^ is some kind of logical operator.)

Where are the dang exponents?
Code:
```#include <iostream>

int main ()
{
int i = 1;
while (i <= 10)

{
std::cout<<i*i<<std::endl;
++i;

}

system("PAUSE");
return 0;
}```
I've googled and searched the site but I'm sure you guys can answer this in far less time that it will take me to flounder around.

Thanks!

-JM

2. ^ is the bitwise "xor" operator. try using the pow( ) function from <cmath>.

3. Perfect! Thanks!

Code:
```#include <iostream>
#include <cmath>

int main ()
{
int i = 0;
while (i <= 16)

{
std::cout<<pow(2,i)<<std::endl;
++i;
}

system("PAUSE");
return 0;
}```

4. if you want to make a power function yourself:
Code:
```double power(double base, double exp)
{
if(exp == 1)
return base;
if(exp == 0)
return 0;
else
return base * power(base, exp - 1);
}```

5. Except if exp is zero you should return 1...

6. Yeah, and the thing will overflow the stack for any non-integral or negative exponent.