The file power1.dat contains power plant output in megawattsover a period of 10w
ID: 3617831 • Letter: T
Question
The file power1.dat contains power plant output in megawattsover a period of 10weeks. Each row of data contains 7 floatingpoint numbers that represent one weeks data. In developing theprogram, use symbolic constraints NROWS and NCOLS to represent thenumber of rows and columns in the two dimensional array used tostore the data.
Write a program that
1. opens the file to input
2. Reads the file and stores the data in a two dimensionalarray
3. Displays the day of the week and the number of the weeks onwhich the minimum power output occurred. If there are several dayswith the minimum power output, display the information for each ofthese days.
This are the values power1.dat filecontains:
207 301 222 302 22 167 125
367 60 120 111 301 499 434
211 62 441 192 21 293 316
401 340 161 297 441 117 206
448 111 370 220 264 444 207
21 313 204 222 446 401 337
213 208 444 321 320 335 313
162 137 265 44 370 315 322
150 218 234 384 283 199 204
204 245 287 298 302 288 297
Explanation / Answer
please rate - thanks #include #include using namespace std; #define NROWS 10 #define NCOLS 7 int main() {double pp[NROWS][NCOLS],min=2000; int i,j; string day[7]={"sun","mon","tue","wed","thu","fri","sat"}; ifstream in; srand(time(0)); in.open("power1.dat"); if(in.fail()) //is it ok? { coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.