Answer:
C code explained below
Step-by-step explanation:
I have provided the proper commented code below.
I hope that you find the answer helpful.
CODE:
-------------------------------------------------------------------------------------------------------------
#include<bits/stdc++.h>
using namespace std;
int main(){
// Defining Variables
int no_of_weeks;
int total_cases = 0;
//Declaring Vector of Pair of Integer and string
std::vector<pair<int,string>> data;
// Taking Input for the Number of Weeks
cout<<"Enter No. of Weeks\\";
cin >> no_of_weeks;
// Running the Loop for no_of_weeks times
for(int i = 0; i < no_of_weeks ; i++){
int A,B,C;
// Taking Input for different types of flus
cout<<"Enter No. of Cases of Flu A, B, C for week" << i + 1 << " seperated by space : \\";
cin >> A >> B >>C;
// Adding all the cases in a week
int cases_in_a_week = A + B + C;
// Updating total cases
total_cases += cases_in_a_week;
// Declaring the level variable
string level;
// Updating the level of the week corresponding to each case
if(cases_in_a_week < 500) level = "Low";
else if(cases_in_a_week >= 500 && cases_in_a_week < 2000) level = "Moderate";
else level = "Widespread";
// Storing the Week's information by using a vector of pairs
// in which pair's first is the number of cases which is of type int
// while the second is the level of the flu which is of the type string
data.push_back(make_pair(cases_in_a_week,level));
}
// Linking the stdoutput to the flu_report.txt file
// this also creates the file with the same name if it doesn't exists
freopen("flu_report.txt", "w", stdout);
// Printing the respective output data with Bar Chart of stars for each level
for(int i = 0;i < no_of_weeks ; i++)
//printing the week no. and number of cases
cout<<i+1<<" "<<data[i].first<<" "<<data[i].second<<"
//printing the total number of cases
cout<<total_cases;
}