ed Terminal sessions View Xserver Touls Ganmes Setting Macros Help Servers ng Ad
ID: 3848655 • Letter: E
Question
ed Terminal sessions View Xserver Touls Ganmes Setting Macros Help Servers ng Ada Settings fa for (i 0: i IM DAYS: i++) if rainfaltli1101 maxyear maxyear rain td maxsixt maxyear; (j 0; j NUM DAYS 18; j++) tor if (rainfall [j][1] maxyear) max year rainfall max svnt naxyear. printf( Highest daily rainfall i 2016 was May 1 with 5.2f inches", maxsixt); printf Highest daily rainfall in 2017 was May 21 with .2f nches maxsvnt); //calculates and prints out the averages of 2016 & 2017 void tindAverage float rainfall NUM COLS oat raintdL NUM COLS int ndays2 float sumone *0.00, sumtwo 0.00; float avgone, avgt int i, j; tor (i 0 i ndays2P i sumone rainfall[i][0]; for (j 0: j days? 18; j++) sum two rainfall Write out Read File Get Help Prev tify Where Next Pg NREGISTERED VERSTON atek net a Type here to search Cut Text nCut Text r Pos To Spe 6/2/2011Explanation / Answer
You can store the average and maximum rainfall in arrays in both the functions and send them to the main function as parameters, instead of printing it in the functions itself. You should have posted your main function or even the question so that i could make the program for you or mend it for you. But i dont have anything to work with. But the maximum i can do is show you how to return an array from a function.
Suppose we have a function ret:
to return an array from ret(), this is how we do it:
int* ret()
{
int a[10];
for(int i=0;i<10;i++)
a[i]=i;
return *a;
}
this is the main function:
void main()
{
int *b;
b=ret();
}
Hope it helps. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.