sum+=num;
Try putting this before the loop starts.
Then try putting it inside the loop.
Think about whether it should go before or after the adjustment of num.
Ohh it works when it's in the loop how? But another problem is how can I make the 3, 6, and 9 into 3.0, 6.0 and 9.0
But setprecision doesn't add .0 to the whole numbers.
Keep reading.
iomanip has lots of things for you to try.
Ohh sh*t I got it, thanks man!