
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Edition 8ISBN: 978-1285867410
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Edition 8ISBN: 978-1285867410 Exercise 14
Accumulating Totals in a Loop
const int DAYS_IN_WEEK = 7;for(counter = 1; counter = DAYS_IN_WEEK; counter++){cout ? "Enter rainfall amount for Day " + counter ? ": ";cin rainfall;cout ? "Day " ? counter ? "rainfall amount is " ?rainfall ? " inches" ? endl;sum += rainfall;}// calculate averageaverage = sum / DAYS_IN_WEEK;
The variables sum, rainfall, and average should be declared to be what data type to calculate the most accurate average rainfall?
const int DAYS_IN_WEEK = 7;for(counter = 1; counter = DAYS_IN_WEEK; counter++){cout ? "Enter rainfall amount for Day " + counter ? ": ";cin rainfall;cout ? "Day " ? counter ? "rainfall amount is " ?rainfall ? " inches" ? endl;sum += rainfall;}// calculate averageaverage = sum / DAYS_IN_WEEK;
The variables sum, rainfall, and average should be declared to be what data type to calculate the most accurate average rainfall?
Explanation
" double " data type:
The variables rai...
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
Why don’t you like this exercise?
Other Minimum 8 character and maximum 255 character
Character 255