(1) Generate a power plant output (random numbers between 500and 1000 ) in megaw
ID: 3617838 • Letter: #
Question
(1) Generate a power plant output (random numbers between 500and 1000 ) in megawatts over a period of 10 weeks. Each row of datacontains 7 floating-point numbers that represent 1 week's data. Usesymbolic constants NROWS and NCOLS to represent the number of rowsand columns in the 2-D array. Apply srand() in the program.
(2) Compute and print the average power output over this 10-weekperiod. Print the number of days with greater-than-average poweroutput.Also print the day of the week and the number of the week onwhich the output is greater-than-average.
(3) Print the day of the week and the number of the week onwhich the minimum and maximum power output occurred.If there areseveral days with the minimum and maximum power output, print theinformation for each of these days.
(4) Record all output in a datafile, power1.dat .
Explanation / Answer
please rate - thanks #include #include using namespace std; #define NROWS 10 #define NCOLS 7 int main() {double pp[NROWS][NCOLS],sum=0,average,min=2000,max=0; int i,j; string day[7]={"sun","mon","tue","wed","thu","fri","sat"}; ofstream out; srand(time(0)); out.open("power1.dat"); for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.