c++ calorie calculator using a for loop

#include <iostream>

int main() {
    // Declare variables
    int numFoods;
    double totalCalories = 0;

    // Prompt user for the number of foods
    std::cout << "Enter the number of foods: ";
    std::cin >> numFoods;

    // Use a for loop to iterate over each food
    for (int i = 1; i <= numFoods; ++i) {
        double calories;

        // Prompt user for the calories of each food
        std::cout << "Enter the calories for food " << i << ": ";
        std::cin >> calories;

        // Add calories to the total
        totalCalories += calories;
    }

    // Display the total calories
    std::cout << "Total calories: " << totalCalories << std::endl;

    return 0;
}