This problem taught you about floating-point arithmetic. You learned that int can't represent decimals, so you need double for fractional values. You also saw how integer division can silently give wrong results if you're not careful with types.
I showed you how to control output formatting. The fixed and setprecision manipulators let you specify exactly how many decimal places appear. note that when problems require specific output formats, which happens often in competitive programming.
You also learned about translating formulas from math to code. The order of operations matters - multiplication and division before addition.