blob: a9fbf0d60a0d70898ae5f6f69bac830a9a531fe7 (
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
|
// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
//William Bishop
//[email protected]
#include <iostream>
using namespace std;
using std::cout;
using std::cin;
using std::endl; Here we have the headers to start the code.
int CelciusintoFahrenheit1(float F);
int WindMPH(float wind);
void WinddChill(float chill, float wind); Here I have the three functions that I am using to create a different work to create the information of the main function
int main()
{
const int maxC = 49.5;
const int maxF = 121;
const int minC = -62;
const int minF = -80; Here we have the constants of the max and min of the Celcius and Fahrenheit temperatures.
float windspeed;
float temperature; Here we have some starting variables.
cout << "Please enter the temperature in Fahrenheit or Celcius. Please also enter the wind speed in mph." << endl;
cout << "Please enter the fahrenheit temperature from -80 to 121." << endl;
cout << " Please enter the temperature from celcius should be from -62 to 49.5 and the speed should be 0 to 231 mph." << endl; Here we ask for some windspeed and temperature values
float CelciustoFahrenheit;
cin >> temperature;
cin >> windspeed; Here we get some more values
CelciustoFahrenheit = (9 / 5) * temperature + 32; Here we calculate celcius to fahrenheit.
if (CelciustoFahrenheit >= minC && CelciustoFahrenheit <= maxC)
cout << "Thank you for entering a great temperature.";
else
cout << "Please enter another temperature." << endl; Here we get the input for the temperature and if it isn't a right value then we get another value from the user
cin >> temperature;
float windchillFromCelc;
float windchillFromFahr; Here we have the wind chill variables.
windchillFromCelc = windspeed * .7 - CelciustoFahrenheit;
windchillFromFahr = windspeed * .7 - temperature; Here we are calculating wind chill.
float WindChill;
WindChill = windchillFromFahr;
cout << "The wind chill from the temperature if you entered entered the temperature in Celcius is: " << windchillFromCelc << endl;
cout << "The wind chill from the temperature if you entered the temperature in Fahrenheit is : " << windchillFromFahr << endl; Here we are outputting the windchill variables.
cout << temperature << " " << CelciustoFahrenheit << " " << windspeed << " " << windchillFromFahr << " " << windchillFromCelc << endl; Here we are outputting our temperature, windspeed and windchill
cout << " We see Temperature, then the temperature if it were celcius into fahrenheit and then the windspeed. ";
cout << "We also see the windchill from temperature if it were in fahrenheit and if it were in celcius." << endl; We are talking about the output.
int CelciusintoFahrenheit1(float F);
int WindMph(windspeed);
int x = 5;
int y = 7;
WinddChill(windchillFromCelc, windspeed); Here we have our three functions in the program
}
int CelciusintoFahrenheit1(float F)
{
int temperaturec;
cout << "please enter a temperature."; Here is a function to return the value of a temperture from celcius into Fahrenheit.
cin >> temperaturec;
F = (9 / 5) * temperaturec + 32; //Here is the function where I am returning a value meaning F as the Fahrenheit Temp.
return F;
}
int WindMPH(float wind)
{
int MPH;
MPH = wind;
cout << "Please enter a wind speed."; //Here I am passing by reference with the wind and windspeed into main.
cin >> MPH;
cout << wind; Here are passing by reference the wind from MPH into the windspeed inside of main.
}
void WinddChill(float chill, float wind)
{
float c;
c = chill;
float d;
d = wind;
cout << "Thank you please enter a float for the chill and wind."; //Here I am passing by value into the function.
cin >> chill;
cin >> wind;
cout << chill; Here we are passing by value a couple more values into the program so someone could use them later.
cout << wind;
}
|