int main()
{
/* Define and initialize variables. */
int reject, batch, count(0);
exit(1);
}
/* Check that the data really is for rejected suture packages. */
while(suture >> batch >> temperature >> pressure >> dwell_time)
{
reject = false;
if ((temperature<MIN_TEMP) || (temperature>MAX_TEMP))
}
}
}
/*——————————————————————–*/
Timber Regrowth
/*——————————————————————–*/
/* Problem chapter5_27 */
/* */
/* Assume that there are 14,000 acres total with 2500 acres */
using namespace std;
const double REFOREST_RATE = 0.02;
{
year++;
}
// Exit program.
return 0;
}
/*——————————————————————–*/
/*——————————————————————–*/
int main()
{
// Declane and initialize variables.
int year=1, max_years(0);
double forested=UNCUT_ACRES;
// Print headers.
// Print headings.
cout << “\n\nYEAR FORESTED ACRES AT END OF YEAR \n”;
cout << “————————————– \n”;
// Compute and print yearly reforestation information.
while (year <= max_years)
{
/* user can enter the number of acres and the program will */
/* determine how many years are required for the number */
/* of acres to be completely reforested. */
#include <iostream>
using namespace std;
// Read acres to be reforested.
while ((acres>MAX_ACRES) || (acres<UNCUT_ACRES))
{
cout << “Enter acres to be reforested: “;
cin >> acres;
}
// Set format.
// Print years required for reforestation.
cout << “\n\nUp to ” << year << ” years are required to reforest “
<< acres << ” acres\n”;
// Exit program.
return 0;
}
/*——————————————————————–*/
Weather Patterns
int main()
{
/* Declare and initialize variables. */
int i, below0(0), from0to32(0), from33to50(0), from51to60(0),
}
/* Read data and count days in temperature categories. */
while(weather >> dummy >> max_temp >> min_temp)
{
if (min_temp < 0) {
below0++;
from61to70++;
} else if (max_temp > 50) {
from0to32++; //Since the temperature went through these ranges
from33to50++;
from51to60++;
from61to70++;
above70++;
} else if (max_temp > 60) {
from33to50++; //Since the temperature went through these ranges
from51to60++;
from61to70++;
above70++;
} else if (max_temp > 60) {
from51to60++; //Since the temperature went through these range
from61to70++;
from61to70++;
if (max_temp > 70) {
above70++;
}
} else {
above70++;
}
cout << “61 to 70\t \t\t” << from61to70 << endl;
cout << “Above 70 \t \t\t” << above70 << endl;
/* Close file and exit program. */
weather.close();
return 0;
}
const int DATA_PER_DAY = 32;
const string FILE1 = “jan91.dat”;
const int TEMP_DATA = 3;
int main()
{
/* Declare and initialize variables. */
exit(1);
}
/* Read data and count days in temperature categories. */
while(weather >> dummy >> max_temp >> min_temp)
{
if (min_temp < 0) {
below0++;
from61to70++;
} else if (max_temp > 50) {
from0to32++; //Since the temperature went through these ranges
from33to50++;
from51to60++;
from61to70++;
above70++;
} else if (max_temp > 60) {
from33to50++; //Since the temperature went through these ranges
from51to60++;
from61to70++;
above70++;
} else if (max_temp > 60) {
from51to60++; //Since the temperature went through these range
from61to70++;
from61to70++;
if (max_temp > 70) {
above70++;
}
} else {
above70++;
}
cout << “51 to 60\t \t\t” << double(from51to60)/days*100 << endl;
cout << “61 to 70\t \t\t” << double(from61to70)/days*100 << endl;
cout << “Above 70 \t \t\t” << double(above70)/days*100 << endl;
/* Close file and exit program. */
weather.close();
return 0;
const int DATA_PER_DAY = 32;
const int TEMP_DATA = 3;
case 5:
case 6:
case 7:
case 8:
FILE1=”aug91.dat”;
break;
}
weather.open(FILE1.c_str());
/* Read data and count days in temperature categories. */
while(weather >> dummy >> max_temp >> min_temp) {
if (min_temp < 0) {
below0++;
cout << “min_temp below 0”;
from33to50++;
from51to60++;
from61to70++;
from0to32++;
if (max_temp > 70) {
from33to50++; //Since the temperature went through these ranges
from51to60++;
from61to70++;
}
} else if (min_temp <= 50) {
from33to50++;
if (max_temp > 70) {
from51to60++; //Since the temperature went through these ranges
from61to70++;
above70++;
} else if (max_temp > 60) {
from61to70++;
}
} else if (min_temp <=70) {
from61to70++;
cout << “May through August of 1991” << endl;
cout << “Temperature Ranges \t Number of Days ” << endl;
cout << “Below 0 \t \t\t” << below0 << endl;
cout << “0 to 32 \t \t\t” << from0to32 << endl;
cout << “33 to 50\t \t\t” << from33to50 << endl;
/* days with fog in November 1991. */
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
weather.open(FILE1.c_str());
/* Read data and count foggy days. */
while(weather >> dummy >> dummy >> dummy >> ave_temp )
{
/* Ignore data up to the fog information. */
for (i=4; i<FOG_DATA; i++)
if (foggy >0 )
cout << “Average temperature for the ” << foggy << ” foggy days in “
<< “Nov 1991: ” << ave_foggy/foggy << endl;
else
cout << “No foggy days in Nov 1991.\n”;
/* Close file and exit program. */
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
const int DATA_PER_DAY = 32;
while(weather >> day >> max_temp >> min_temp)
{
difference = max_temp min_temp;
if (big_difference < difference)
{
dayofmonth = day;
big_difference = difference;
/* Close file and exit program. */
weather.close();
return 0;
}
/*——————————————————————–*/
Critical-Path Analysis
/*——————————————————————–*/
/* Problem chapter5_35 */
/* */
const string FILENAME = “path.dat”;
int main()
{
/* Declare and initialize variables. */
exit(1);
}
/* Set up the headers before the loop. */
cout << “Event Max Number Days for a Task \n”;
cout << “———————————— \n”;
while(path >> event >> task >> days)
{
}
}
/* Count the last event, and print the total project duration. */
project_days += max_days;
cout << event << ” ” << max_days << endl;
cout << “Project duration: ” << project_days << endl;
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
}
/* Set up the headers before the loop. */
cout << “Tasks requiring more than ” << MAX_DAYS << ” days:\n”;
cout << “Event Task Days \n”;
cout << “———————– \n”;
/* */
/* This program reads the critical path information */
/* and prints a report that lists the number of each event */
/* and a count of the number of tasks within the event. */
#include <iostream>
exit(1);
}
/* Set up the headers before the loop */
printf(“Event Number of Tasks \n”);
printf(“———————————— \n”);
/* Read data and print event information. */