c++ correct upto 3 decimal places

#include <iostream>
#include <iomanip>

int main() {
    // Declare variables
    double num1, num2, result;

    // Prompt user for input
    std::cout << "Enter the first number: ";
    std::cin >> num1;

    std::cout << "Enter the second number: ";
    std::cin >> num2;

    // Perform the addition
    result = num1 + num2;

    // Set the precision to 3 decimal places
    std::cout << std::fixed << std::setprecision(3);

    // Display the result
    std::cout << "The sum of " << num1 << " and " << num2 << " is: " << result << std::endl;

    return 0;
}