Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Scientists are involved in a study to record the total number of bad winter days

ID: 3823868 • Letter: S

Question

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).
Attached the input file to be used for your program. 3 7 2 6 7 -8 -4 -3 7 -5 -2 -6 -8 2 0 3 5 5 4 3 -1 -4 -5 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).
Attached the input file to be used for your program. 3 7 2 6 7 -8 -4 -3 7 -5 -2 -6 -8 2 0 3 5 5 4 3 -1 -4 -5 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).
Attached the input file to be used for your program. 3 7 2 6 7 -8 -4 -3 7 -5 -2 -6 -8 2 0 3 5 5 4 3 -1 -4 -5 3 7 2 6 7 -8 -4 -3 7 -5 -2 -6 -8 2 0 3 5 5 4 3 -1 -4 -5

Explanation / Answer


#include <bits/stdc++.h>
using namespace std;

int write()
{
ofstream outfile;
int week,days, day;

outfile.open(("L:\pradeep\PersonalData.txt"));
cout<<"Enter Total Number of week: ";
cin>>week;
outfile<<week<<" ";
cin>>days;
outfile<<days<<" ";
for(int i=0;i<week;i++)
{
for(int j=0;j<days;j++)
{
cin>>day;
outfile<<day<<setw(2);
}
outfile<<" ";
}
outfile.close();
cout<<"Writing Completed."<<endl;
return 1;

}

int main()
{
int write();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote