expand icon
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
Exercise 17
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;
Could you replace DAYS_IN_WEEK in the statement average = sum / DAYS_IN_WEEK; with the variable named counter and still get the desired result? Explain.
Explanation
Verified
like image
like image

blured image
, if the variable DAYS_IN_WEEK present...

close menu
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
cross icon