Dear Sanoz0r,
I tried your code on my laptop both with and without the casting to int of the returned double from the pow(double, double) function.
In both cases I got:
i=0 : 1
i=1 : 10
i=2 : 100
i=3 : 1000
i=4 : 10000
in other words, I did not get any casting problems.
I don't know if it makes any difference but I have gone back to the 2006 UNISA disk (for both mingw and DevC++ installations) - in fact I posted a link where it can be downloaded for those who are having compiling problems with the 2007 disk. (See the'Dev C++ errors' thread.) Alternatively, perhaps different computers have slightly different ways of doing floating point calculations within their processors.
Even despite my not having casting errors when trying to replicate your problem, I don't much like the idea of casting from double to int like that. This is because floating point arithmatic is imprecise and small differences could crop up and become more pronounced when casting, e.g. 99.99999... (very close to 100) going to 99 when the fractional part is dropped for casting to a variable of type int. I don't think you are alone in experiencing casting problems, e.g. see:
http://www.thescripts.com/forum/thread133037.html
I simply wrote my own power function that works on type int. This way you should not need to worry about casting 'errors' - the function is relatively trivial and uses iteration since that would be faster than recursion.
Perhaps a lecturer could confirm:
1) what could give rise to casting problems - am I on the right track?
2) whether it is/is not good practice to cast the results from double to int?
My thrupence worth.
Richard