Source Code
#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 RainyMounth = 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;
mounth++;
}
in >> test;
weather[mounth][days] = test[0];
days++;
}
else
{
in >> test;
}
}
int Fday = 0;
int Fmounth = 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;
Fmounth = i;
}
Fday = 0;
}
cout << "June\t" << "July\t" << "August\t" << endl;
for (int count = 0; count < 30; count++)
{
cout << count + 1 << ".";
cout << weather[0][count] << "\t";
cout << weather[1][count] << "\t";
cout << weather[2][count] << endl;
}
switch (Fmounth)
{
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;
}weather.txt:
```
June
C
S
R
C
S
C
R
S
C
C
S
C
S
C
S
S
R
S
S
C
C
S
C
S
C
S
C
C
S
C
July
R
S
C
S
R
S
S
R
C
C
R
S
S
S
C
C
S
R
S
S
C
R
S
C
S
R
S
S
S
S
August
C
S
C
S
C
C
C
C
C
C
R
C
N
C
S
R
S
C
R
C
C
C
C
C
C
C
C
C
C
```