Question: (15 points) Write a complete C++ program that uses a while loop and if...else chain to process a collection of daily temperatures in Celsius.

  • (15 points) Write a complete C++ program that uses a while loop

(15 points) Write a complete C++ program that uses a while loop and if...else chain to process a collection of daily temperatures in Celsius. Your program should continuously read temperatures from the user until he/she enters 0. Your program should count and print the number of hot days (temperature 30 or higher), the number of pleasant days (temperature 18-29) and the number of cold days (temperature less than 18). When the user enters 0, your program should terminate and display the total number of hot days, pleasant days and cold days. Sample Run Please enter a temperature: 35 Please enter a temperature: 12 Please enter a temperature: 23 Please enter a temperature: 28 Please enter a temperature: 0 You have entered 1 hot day(s), 2 pleasant day(s) and 1 cold day(s).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a C program that implements the functionality you described include iostream int main in... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (2 attachments)

PDF file Icon

6642f777eed9c_969833.pdf

180 KBs PDF File

Word file Icon

6642f777eed9c_969833.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!