Solved

# output into a table format

Posted on 2003-02-18

Below is a code that is supposed to print out a Wind Chill Temperature table for temperature values ranging from 30 °F down to -15 °F, in 5 degree decrements, and wind speeds ranging from 5 mph up to 35 mph, in 5 mile per hour increments. I am having trouble getting the program to compute or read the values from the WindChillTemp function. Help is much appreciated.

#include <iostream>

#include <string>

#include<complex>

#include<iomanip>

using namespace std;

double WindChillTemp (double t, double v)

{

double x = 35.74 + 0.6215 * t - 35.75 * pow(v,0.16) + 0.4275 * t * pow(v,0.16);

return x ;

}

int main(){

double T,V;

double result;

cout<<" ";

for (T=30; T >= -15 ; T -= 5)

{

cout<<T<<"\t";

}

cout<<endl;

cout<<"*******************************************************************************";

cout<<endl;

for (V=5; V <= 35 ; V+=5)

cout<<V<<endl;

{

for(T=30; T >= -15 ; T -= 5);

{for (V=5; V <= 35 ; V+=5)

cout<<setprecision(2)<<WindChillTemp(T,V)<<"\t";

}

}

cout<<endl;

//for(T = 30 ; T >= -15 ; T = T - 5)

//{

//for (V = 5; V >= 35; V += 5)

//{

//result = WindChillTemp (T, V);

//cout<< result<<"/t";

//}

//}

return 0;

}