The rainfall figures in mm are available for each day of the past four weeks. Write a function generateReport() that displays the total rainfall for each week and the most wettest day. The function takes as parameter a two-dimensional array named, figures of size 4 x 7, that contains rainfall figures in which each row represent a week and each column represent a day.
For example, if the array contains the following rainfall data:
#include<iostream>
using namespace std;
void generatereport (int x[][7],int row)
{
int sum,wet=0,wek,maxd;
cout<<"Week Rainfall Total"<<endl;
for (int i=0;i<row;i++)
{
sum=0;
cout<<i+1<<"\t";
for (int j=0;j<7;j++)
{
cout<<x[i][j]<<" ";
sum+=x[i][j];
if (x[i][j]>wet)
{
wet=x[i][j];
wek=i;
maxd=j;
}
}
cout<<" \b\t"<<sum<<endl;
}
cout<<endl<<"The wettest day was day "<<maxd+1<<" in week "<<wek+1<<endl;
}
int main()
{
int x[4][7]={{3,0,0,7,8,21,0},{0,1,1,0,0,0,4},{9,6,7,0,0,0,0},{0,0,0,0,0,0,1}};
generatereport(x,4);
system ("pause");
return 0;
}
this, i never liked devc++ because it's ugly and doesn't provide much
try QtCreator, it's awesome and even provides a GUI designer https://www.qt.io/download-open-source/
well, your programm works, just test it online in cpp.sh for the time being: http://cpp.sh/9xuz