Originally Posted by
cooper1200
it also doesnt take variables as an argument ie pow( x, y ) doesn't work
I'm not sure why you would think that. It sure can take variables as arguments:
Code:
$ cat test-pow.c
#include <math.h>
#include <stdio.h>
int main()
{
double x = 311.1696, y = 0.25;
printf("%f\n", pow(x, y));
return 0;
}
$ gcc -Wall -O2 -o test-pow test-pow.c -lm
$ ./test-pow
4.200000
Also, you can condense your whole switch statement to something like this:
Code:
printf("%0.*f\n", iCount, iResult);
The star (*) tells printf to take the next int argument for that value.