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

In C++ We want to track weather conditions during the past year\'s three-month s

ID: 3676220 • Letter: I

Question

In C++

We want to track weather conditions during the past year's three-month summer season as has designated each day as either rainy ('R'), cloudy ('C'), or sunny ('S').

Write a program that stores this information in s 3x30 array of characters, where the row indicates the month and the column indicates the day of the month. Note no data is being captured for the 31st of any month.

This program will read the data in from a file called RainOrShine.txt. From this data it you should create a report that displays , for each month and for the whole three month period, how many days were rainy, how many were cloudy, and how many were sunny. It should also report which of the months had the largest number of rainy days.

The rain or shine text has the following information:

R C R S R S R R S R S C R C S S S S R S C S R C S S C C R S
C R R R S R S R C S R C R S S S R S C R R S C C S C S C R R
C R C C S C C R R R S S S C R C C C R C R S S S R S C R R C

The output should look like this:

Explanation / Answer

#include "conio.h"
#include "string"
#include "iostream"
#include "fstream"
using namespace std;
int main()
{
char weather[3][30]
string test;
int days = 0;
int mounth = 0;
int RainyMonth = 0;
int RainyDay = 0;
ifstream in("weather.txt");
for (int i = 0; i < 93; i++)
{
if (i != 0 && i != 31 && i != 62)
{
if (days > 29)
{
days = 0;
month++
}
in >> test;
weather[month][days] = test[0];
days++;
}
else
{in >> test;
}
}
int Fday = 0;
int Fmonth = 0;
int current = 0;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 30; j++)
{
if (weather[i][j] == 'R')
{
Fday++;
}
if (Fday > current)
{
current = Fday;Fmonth = i;
}
Fday = 0;
}
cout << " June " << "July " << "August " << endl;
for (int count = 0; count < 30; count++)
{
cout << count+1 << ".";
cout << weather[0][count] << " ";
cout << weather[1][count] << " ";
cout << weather[2][count] << endl
switch (Fmonth)
{
case 0:cout << "Largest number of rainy days : June" << endl;
break;
case 1:cout << "Largest number of rainy days : July" << endl;
break;
case 2:cout << "Largest number of rainy days : August" << endl;
break;
}
system("pause");
return 0;
}