blob: 9a870a35421f12641a03b36934f8331f6c5b5d03 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#include <iostream>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
using std::string;
char y;
char n;
int fahrenheit(int t);
int windchill();
int fahrenheit(int t)
{
int f{};
//f = (t * (9 / 5)) + 32;
f = (9 / 5) * t + 32;
return f;
}
int main()
{
float t{};
float f{};
float w{};
float wc{};
char choice{};
//collects a temp
cout << "Enter a temperature between -80 and 121: ";
cin >> t;
//makes sure temp is between -80 and 121
while (t < -80 || t > 121)
{
cout << "Input invalid, please enter a number between -80 and 121" << endl;
cin.ignore(99, '\n');
return t;
}
cout << f << endl;
cout << "type y or n" << " is the tempterature in fahrenheit?";
// cin >> choice;
if (choice == 'n')
{
f = fahrenheit(t);
}
if (choice == 'y')
{
cout << "no change";
}
//collects windspeed
cout << "Enter a wind speed between 0 and 231: ";
cin >> w;
//windspeed between 0-231
while (w < 0 || w > 231)
{
cout << "Input invalid, please enter a number between 0 and 231" << endl;
cin.ignore(99, '\n');
return w;
}
//f = temp w = wind
wc = (35.74 + 0.6215 * f - 35.75 * pow(w, 0.16) + .4275 * f * pow(w, 0.16));
return wc;
//displays wind, temp, and windchill
cout << w << endl;
cout << f << endl;
cout << wc << endl;
}
|