Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Program Write a program using structures to store the following weather info

ID: 3691161 • Letter: C

Question

C++ Program

Write a program using structures to store the following weather information:

•Total Rainfall

•High Temperature

•Low Temperature

•Average Temperature

Use an input file called input.txt to load the data to your array of 12 structures to hold the weather data (the average temperature should be calculated). Once the data for all the months is entered, the program should calculate and display the average monthly rainfall, total rainfall for the year, highest and lowest temps for the year (and the months they happen in) and the average of all the months average temperatures. Input temps should be between -100 and +140 and and total rainfall must not be less than 0

Output:

Annual Rain Analysis Total Rain: 117.00 Average Rain: 9.75 Average of average rain: 49.50 The highest temp is: 102.00 in August The Lowest temp is: -30.00 in February

Explanation / Answer

#include<iostream. h>

#include<conio. h>

class weather

{

int nummonth=12;

double get totalrainfall(double[]);

double get average(double[]);

double get hightemp(double[]);

double get lowtemp(double[]);

Int main()

{

Weather month[num_month];

Int index;

double totalrainfall;

for(int index=0; index<12; index++)

{

cout<<”enter the rainfall for month n”;

cout<<”index increased bu 1<<””;

cin>>month[index]rainfall;

cout<<”total rainfall for 12month”;

cout<<month[index]rainfall<<end;

double get average(double rainfall[])

double average=0. 0;

average=get total(rainfall);

return average;

}

double get hightemp(double rainfall])

{

double hightemp;

highest=rainfall(0);

for(int month=0; month<12; month++);

{

If (rainfall[month]>hightemp);

{

Hightemp=rainfall[month];

amount=month;

}

Return hightemp;

}

}

double get lowtemp(double rainfall])

{

double lowtemp;

Lowtemp=rainfall(0);

for(int month=0; month<12; month++);

{

If (rainfall[month<lowtemp);

{

lowtemp=rainfall[month];

amount=month;

}

Return lowtemp;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote