I am new to this and have no experience, so any help would appreciated. Here is my problem:
Wind Chill = 35.74 + 0.6215T – 35.75(V^0.16) + 0.4275T(V^0.16)
Note: Windchill Temperature is only defined for temperatures at or below 50 degrees F and wind speeds above 3 mph. Bright sunshine may increase the wind chill temperature by 10 to 18 degrees F.
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
usingnamespace std;
double windChillFactor (constdouble &v, constdouble &t)
{
double w = 0.0;
w = 35.74 + (0.6215*t) - 35.75 * pow(v,0.16) + (0.4257*t) * pow(v,0.16);
return w;
}
int main()
{
bool canRun = true;
int input;
double v = 0.0;
double t = 0.0;
double w = 0.0;
do
{
cout << "Please enter the wind speed in miles per hour (v): ";
cin >> v;
if (v <= 3)
{
cout << "Wind speed is to slow, try again ";
}
elseif (input <= 3)
canRun = false;
}
cout << "Please enter the temperature in degrees Farenheit (t): ";
cin >> t;
if (t <= 50)
{
cout << "The tempature is to high, try again ";
}
}
while(v > 3 && t >= 50);
w = windChillFactor(v,t);
cout << "Wind Chill is: " << w << endl;
}
return 0;
I added my variables and now get an error at:
cout << "Please enter the temperature in degrees Farenheit (t): ";
says(expected unqualified-id below "while.
I have tried to understand the do while command but I am unsure.
I am trying to get it to reset if the 3 and below and the 50 and below are not met. I thought I had to use the else if command but unsure what I am doing.
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
usingnamespace std;
double windChillFactor (constdouble &v, constdouble &t)
{
double w = 0.0;
w = 35.74 + (0.6215*t) - 35.75 * pow(v,0.16) + (0.4257*t) * pow(v,0.16);
return w;
}
int main()
{
bool canRun = true;
int input;
double v = 0.0;
double t = 0.0;
double w = 0.0;
do
{
cout << "Please enter the wind speed in miles per hour (v): ";
cin >> v;
if (v <= 3)
{
cout << "Wind speed is to slow, try again ";
}
elseif (input <= 3)
canRun = false;
cout << "Please enter the temperature in degrees Farenheit (t): ";
cin >> t;
if (t <= 50)
{
cout << "The tempature is to high, try again ";
}
}
while(v > 3 && t >= 50);
w = windChillFactor(v,t);
cout << "Wind Chill is: " << w << endl;
system("pause");
return 0;
}