#include <iostream>
#include <iomanip>
#include <vector>

class WeatherReport {
private:
    int day_of_month;
    int hightemp;
    int lowtemp;
    double amount_rain;
    double amount_snow;

public:
    
    WeatherReport() : day_of_month(99), hightemp(999), lowtemp(-999), amount_rain(0), amount_snow(0) {}

    
    void inputData() {
        std::cout << "Enter day of month: ";
        std::cin >> day_of_month;
        std::cout << "Enter high temperature: ";
        std::cin >> hightemp;
        std::cout << "Enter low temperature: ";
        std::cin >> lowtemp;
        std::cout << "Enter amount of rain: ";
        std::cin >> amount_rain;
        std::cout << "Enter amount of snow: ";
        std::cin >> amount_snow;
    }


    void displayReport() const {
        std::cout << "Day of Month: " << day_of_month << std::endl;
        std::cout << "High Temperature: " << hightemp << " F" << std::endl;
        std::cout << "Low Temperature: " << lowtemp << " F" << std::endl;
        std::cout << "Amount of Rain: " << amount_rain << " inches" << std::endl;
        std::cout << "Amount of Snow: " << amount_snow << " inches" << std::endl;
        std::cout << std::endl;
    }
};

int main() {
    std::vector<WeatherReport> monthlyReport;

    int choice;
    do {
        std::cout << "Menu:" << std::endl;
        std::cout << "1. Enter Data" << std::endl;
        std::cout << "2. Display Report" << std::endl;
        std::cout << "3. Exit" << std::endl;
        std::cout << "Enter your choice: ";
        std::cin >> choice;

        switch (choice) {
            case 1: {
                WeatherReport dayReport;
                dayReport.inputData();
                monthlyReport.push_back(dayReport);
                break;
            }
            case 2:
                std::cout << "Monthly Weather Report:" << std::endl;
                for (const auto &report : monthlyReport) {
                    report.displayReport();
                }
                break;
            case 3:
                std::cout << "Exiting program." << std::endl;
                break;
            default:
                std::cout << "Invalid choice. Please try again." << std::endl;
        }
    } while (choice != 3);

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: