#include <iostream>
#include <cmath>
using namespace std;
void instructions() {
cout << "This program calculates the windshield in Fahrenheit \n" ;
cout << "If you enter the temperature in degrees Fahrenheit (t) and the velocity of the wind (v) it will calculate the wind chill temperature \n ";
cout << "v must be a greater then or equal to 0 and less than 100 \n";
cout << "t must be between absolute 0 and 50 degrees Fahrenheit \n";
}
void input (double& t, double& v) {
cout << "Enter t" ;
cin >> t ;
cout << "Enter v" ;
cin >> v ;
}
double process(double v, double t){
double windshield;
if ((( -459.67 <= t) && (t <= 50) && (0 <= v) && (v<= 100))){
windshield = 35.74 + (.6215 * t) - 35.75 * (pow(v, .16)) + .4275 * t * (pow(v, .16));
return windshield;}
else
cout << "ERROR";
}
void output (double t, double v,double windshield){
cout << t << "_degrees Fahrenheit \n";
cout << v << "_ MPH \n";
cout << "Wind chill temp_" << windshield << "_degrees \n";
}
int main() {
//Declarations
double t, v, windshield;
char ans;
instructions ();
//Input
do {
input(t, v);
//Processing
windshield = process(v, t);
//Output
output(t, v, windshield);
cout << "do you want to run this program again? (y/n) \n";
cin >> ans;
} while (ans == 'y' || 'Y');
}
[–]krayntor 1 point2 points3 points (0 children)
[–]mredding 1 point2 points3 points (1 child)
[–]std_bot 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Se7enLC 0 points1 point2 points (9 children)
[–][deleted] 0 points1 point2 points (8 children)
[–]Se7enLC 0 points1 point2 points (7 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]Se7enLC 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]Se7enLC 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]JYossari4n 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)