CMPSC-121辅导C/C++算法、辅导c++程序、辅导讲解C语言程序、辅导 C++
- 首页 >> C/C++编程CMPSC-121: Intro to Programming Techniques
Project 1 (100 points) - Fall 2018
Due Sunday, September 23 at 11:59pm
Objectives
After this project, students should be able to apply various programming techniques including variables,
arithmetic, and output formatting to a single program.
Background
In November 2001, the National Weather Service implemented the new wind chill index, used by the U.S. and
Canadian weather services, which is determined by iterating a model of skin temperature under various wind
speeds and temperatures. The model used standard engineering correlations of wind speed and heat transfer rate.
Heat transfer was calculated for a bare face in wind, facing the wind, while walking into it at 1.4 meters per
second (3.1 mph). The model corrects the officially measured wind speed to the wind speed at face height,
assuming the person is in an open field. The results of this model may be approximated, to within one degree,
from the equivalent formula in U.S. customary units:
where and are measured in , and in mph (miles per hour)
represents actual temperature and represents wind speed, so, for example, if the actual temperature is 22℉
and the wind speed is 15 mph, the wind chill would be 8.8.
Instructions
Write a program named windchill.cpp which varies wind speed from 5 to 45 with an interval of 5 and
temperature from -5 to 50 with an interval of 5, and displays a table of windchill values in a well-formatted
table using loops.
Optional Bonus (+10 points)
For both wind speed and temperature, ask the user to enter the starting and ending values and the interval value.
Then produce the table based on those values.
Twc = 35.74 + 0.6215Ta − 35.75V0.16 + 0.4275TaV0.16
Twc Ta ℉ V
Ta V
Sample Output
Bonus Sample Output
Submission
Submit the following file(s) to Canvas before the deadline:
1. windchill.cpp
Temp | -------------- Wind Speed --------------
5 10 15 20 25 30 35 40 45
-5 -16.4 -22.1 -25.8 -28.6 -30.8 -32.7 -34.3 -35.7 -37.0
0 -10.5 -15.9 -19.4 -22.0 -24.1 -25.9 -27.4 -28.8 -30.0
5 -4.6 -9.7 -13.0 -15.4 -17.4 -19.1 -20.5 -21.8 -23.0
10 1.2 -3.5 -6.6 -8.9 -10.7 -12.3 -13.6 -14.8 -15.9
15 7.1 2.7 -0.2 -2.3 -4.0 -5.5 -6.8 -7.9 -8.9
20 13.0 8.9 6.2 4.2 2.6 1.3 0.1 -0.9 -1.8
25 18.9 15.1 12.6 10.8 9.3 8.1 7.0 6.1 5.2
30 24.7 21.2 19.0 17.4 16.0 14.9 13.9 13.0 12.2
35 30.6 27.4 25.4 23.9 22.7 21.7 20.8 20.0 19.3
40 36.5 33.6 31.8 30.5 29.4 28.5 27.7 26.9 26.3
45 42.3 39.8 38.2 37.0 36.1 35.3 34.5 33.9 33.3
50 48.2 46.0 44.6 43.6 42.8 42.0 41.4 40.9 40.4
Please enter the starting temperature, ending temperature, and
temperature interval: -30 90 20
Please enter the starting wind speed, ending wind speed, and wind speed
interval: 0 5 1
Temp | -------------- Wind Speed --------------
0 1 2 3 4 5
-30 17.1 -31.5 -37.2 -40.8 -43.5 -45.7
-10 29.5 -10.5 -15.2 -18.2 -20.4 -22.3
10 42.0 10.5 6.8 4.4 2.7 1.2
30 54.4 31.5 28.8 27.1 25.8 24.7
50 66.8 52.4 50.8 49.7 48.9 48.2
70 79.2 73.4 72.7 72.3 72.0 71.7
90 91.7 94.4 94.7 94.9 95.1 95.2