blob: 0b6e0a6fc20a70f18ec80264e00a63b3b63f0ede (
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
float Cel;
float Fah;
char Sel;
float WindChill;
float WindSpeed;
void printFunctionCF()
{
//Print Functionn for Celsius to Fahrenheit
cout << "For " << Fah << " Degrees f and " << WindSpeed << " mph winds the windchill is: " << WindChill << endl;
}
void printFunctionFC()
{
//PrintFunction to Celsius To Fahrenheit
cout << "For " << Cel << " Degrees c and " << WindSpeed << " kmh winds the windchill is: " << WindChill << endl;
}
//Celcius to Fahrenheit
int CeltoFar()
{
cout << "The range is between -62 and 49.5" << endl;
cout << "Type your temprature in Celcius: ";
cin >> Cel;
cout << endl;
if (Cel > -62 && Cel < 49.5)
{
cout << "You entered " << Cel << endl;
Fah = 9 / 5 * Cel + 32;
cout << "which is " << Fah << " degrees fahrenheit" << endl;
}
else
{
cout << "Please Try again" << endl;
cout << "Type your temprature in Celcius: ";
cin >> Cel;
cout << endl;
}
cout << "Type the windspeed in mph " << endl;
cin >> WindSpeed;
if (WindSpeed > 0 && WindSpeed < 231)
{
WindChill = 35.74 + .6215 * Fah - 35.75 * pow(WindSpeed, .16) + .4275 * Fah * pow(WindSpeed, .16);
}
else
{
cout << "Please Try again" << endl;
cout << "Type the windspeed in mph " << endl;
cin >> WindSpeed;
}
return WindChill;
return WindSpeed;
return Fah;
}
int FahtoCel()
{ //Fahrenheit to Celcius
cout << "The range is between -79.6 and 121.1" << endl;
cout << "Type your temprature in Fahrenheit: ";
cin >> Fah;
cout << endl;
cout << "You entered " << Fah << endl;
Cel = (Fah - 32) * 5 / 9;
cout << "which is " << Cel << " degrees celcius" << endl;
cout << "Type the windspeed in Km " << endl;
cin >> WindSpeed;
//windspeed in Kilometers
WindChill = 13.12 + .6215 * Cel - 11.37 * pow(WindSpeed, .16) + .3965 * Cel * pow(WindSpeed, .16);
return WindChill;
return WindSpeed;
return Cel;
}
void menuChoice(char& Cel)
{
char CH = Sel;
//If CH is equal to C or c or F or f call
//their respective functions
if (CH == 'C' || CH == 'c')
{
CeltoFar();
printFunctionCF();
}
else if (CH == 'F' || CH == 'f')
{
FahtoCel();
printFunctionFC();
}
}
int welcomeMessageChoice()
{
//Welcome Selection
cout << "Welcome to the Menu!!" << endl;
while (Sel != 'C' && Sel != 'c' && Sel != 'f' && Sel != 'F')
{
cout << "Cel or Fah" << endl << "Please type C or F: ";
cin >> Sel;
}
//MenuChoice Function Call
menuChoice(Sel);
return Sel;
}
//Driver Program
int main()
{
welcomeMessageChoice();
menuChoice(Sel);
}
|