In: Electrical Engineering
The higher the wind speed, the quicker a body cools. To quantify this wind speed chilling effect, both the U.S. and Canadian weather services have determined wind chill temperatures for temperatures below 50°F and wind speeds above 4 mph in the United States and temperatures below 10°C and wind speeds above 4.8 km/hr in Canada. An approximation of the official wind chill temperature, for both metric and English units, is given by this formula:
WCI = K1 + 0.6125 Ta -
K2Ws0.16 +
K3TaWs0.16
The following chart lists the correct dimensions and values for
both systems of units:
| 
 Symbol  | 
 Meaning  | 
 Metric Units (Canada)  | 
 U.S. Customary Units  | 
| 
 WCI  | 
 Wind chill index  | 
 °C  | 
 °F  | 
| 
 Ta  | 
 Measured temperature  | 
 °C  | 
 °F  | 
| 
 Ws  | 
 Wind speed  | 
 km/hr  | 
 mi/hr  | 
| 
 K1  | 
 Conversion factor  | 
 13.12  | 
 35.74  | 
| 
 K2  | 
 Conversion factor  | 
 11.37  | 
 35.75  | 
| 
 K3  | 
 Conversion factor  | 
 0.3965  | 
 0.4275  | 
Using the wind chill formula, write, compile, and run a C++ program that displays a table of wind chill indexes for temperatures from 2°C to 10°C, in 4-degree increments, and for each temperature, wind speeds from 5 km/hr to 11 km/hr in 2-km/hr increments.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
char c;
cout << "Enter your choice that you want to see table in C or F: ";
cin >> c;
switch (c)
{
case 'C':
{
float ws, K1 = 13.12, K2 = 11.37, K3 = .3965, wci;
cout << "Enter wind speed in km/hr: ";
cin >> ws;
int ta;
cout << setw(10) << "Ta" << setw(10) << "Ws" << setw(10) << "WCI" << endl;
cout << "----------------------------------------" << endl;
for (ta = -10; ta <= 10; ta += 5)
{
wci = K1 + (0.6215 * ta) + K2 * ws * 0.016 + K3 * ta * ws * 0.16;
cout << setw(10) <<ta << setw(10) << ws << setw(10) << wci<<endl;
}
}
break;
case 'F':
{
float ws, K1 = 35.74, K2 = 35.75, K3 = .4275, wci;
cout << "Enter wind speed in km/hr: ";
cin >> ws;
int ta;
cout << setw(10) << "Ta" << setw(10) << "Ws" << setw(10) << "WCI" << endl;
cout << "----------------------------------------" << endl;
for (ta = -30; ta <= 20; ta += 10)
{
wci = K1 + (0.6215 * ta) + K2 * ws * 0.016 + K3 * ta * ws * 0.16;
cout << setw(10) <<ta << setw(10) << ws << setw(10) << wci<<endl;
}
}
break;
default:
cout << "Invalid Option."<<endl;
return 0;
}
}