Carrot Symbol

Hey, I know on a calculator a carrot is used a certain way, like in an amortization table. How do I use it in c++ in that same way like this:

var = var^(t*12);

How would I get that to work so it used the carrot like it does on the calculator?
You don't. If you need to raise something to an exponent in C++, you use the pow() function in cmath:

 
var = pow(var,t*12);


The ^ operator has a completely different and unrelated meaning in C++
Last edited on
BTW, a carrot is a vegetable.
The chevron-shaped symbol you are thinking about is a caret.

Hope this helps.
Topic archived. No new replies allowed.