Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Scientists are involved in a study to record the total number of bad winter days in a month. They have obtained the file which consists

Scientists are involved in a study to record the total number of bad winter days in a month. They have obtained the file which consists of the temperature data of a certain month. Write a program in C++ that will read this file and be able to count the total number of days in that given month for which temperature was below zero degree Celsius. You can assume that the maximum number of weeks that can be recorded for a month is at most four and the maximum number of days is at most twenty eight.
The input file structure is as follows:
line 1: an integer value depicting the total number of weeks
line 2: an integer value depicting the number of days for each week that was recorded
line 3 and onwards: integer values (positive and negative) depicting the recorded temperature in degree Celsius for that day
Example Input File:
1 //recorded only for 1 week
3 // recorded only the first 3 days of each week
5 -6 8 //temperature reading for the first 3 days
Your program output for the above example input file should return the value 1 (total number of temperature readings below zero degree Celsius).
3
7
2 6 7 -8 -4 -3 7
-5 -2 -6 -8 2 0 3
5 5 4 3 -1 -4 -5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

ISBN: 0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

3 The distinction between microeconomics and macroeconomics.

Answered: 1 week ago

Question

2 The role of economic theory in economics.

Answered: 1 week ago