Hey guys, this function is for rounding 2 decimal places, e.g. 1.2785 rounds to 1.2800. First, how would I alter the function so it would round 3 decimal places 1.2780, and second how would I truncate it so it would read 1.278.

Thanks!

```
double roundIt(double x, double n) //Write definition for rounding function
{
x = floor( x * pow(10.0, n) + 0.5) / pow(10.0, n);
return x;
}
```