I have to write a program that takes temperature in celsius (if in farenheit, it converts it to celsius) along with the windspeed and calculates the windchill. I have the program written but I can't figure out what I'm doing wrong in lines 63 and 75. Any help would be appreciated!

#include <iostream>
using namespace std;

void FtoC(); //Gets input in farenheit, makes conversion to Celsius, displays results.

void TEMPinC (); //Asks user for the temperature in Celsius.

void WINDSPEED (double SPEED);
          //Asks user for the wind speed in m/sec.

void WINDCHILL(double WINDSPEED, double TEMPERATURE, double WINDCHILL_INDEX);
          //Calculates the windchill from the input information.
void WINDCHILL_OUT();
          //Outputs the results of the conversion.

int main()
{
char repeat;

      cout << "This program will take the wind speed\n"
           << "and the temperature and find the windchill index.\n\n"
           << "wind speed is in m/sec, while\n"
           << "temperature is in degrees Celsius or Farenheit.\n\n";

      do{
      WINDCHILL_OUT();
      cout << "Would you like to make another conversion?\nPlease enter y or n. ";
      cin >> repeat;
      }while(repeat=='y');

      cout << "\nThank you and goodbye.\n";

      system("PAUSE");
      return 0;
}

void FtoC(double FARENHEIT, double& TEMPERATURE)
{
      int which;

      cout << "\nPlease enter 1 to convert celsius and\nenter 2 to convert farenheit. ";
      cin >> which;
      while(which !=1 && which !=2)
      {
         cout << "Please enter 1 or 2. ";
         cin >> which;
      }
      if(which==1)
      {
       cout << "Please enter the temperature in farenheit followed by enter\n";
       cin >> FARENHEIT;
       TEMPERATURE = (FARENHEIT-32)*(5/9);
      }

      else
        TEMPinC();
}

void TEMPinC()
{
cout << "Please enter the temperature in farenheit followed by enter\n";
cin >> TEMPERATURE;
}

void WINDSPEED (double SPEED)
{
   cout << "\nPlease enter the windspeed in m/sec.\n";
   cin >> SPEED;
}

void WINDCHILL(double WINDSPEED, double TEMPERATURE, double WINDCHILL_INDEX)
{
WINDCHILL_INDEX = 13.12 + (0.6215*TEMPERATURE) - (11.37 * (pow(WINDSPEED,0.16)) 
                + (0.3965 * TEMPERATURE * (pow(WINDSPEED,0.016));
}


void WINDCHILL_OUT(double WINDSPEED, double TEMPERATURE, double WINDCHILL_INDEX)
{
  cout << "\nWith a temperature of " << TEMPERATURE << " and a windspeed of\n"
       << WINDSPEED << " the windchill index is " << WINDCHILL_INDEX << " degrees celsius\n\n";
}

Edited 3 Years Ago by happygeek: fixed formatting

[Whoa. I'd suggest ending your preference of CAPITALIZING SYMBOLS.]

Read the error messages.

void TEMPinC()
   {
   cout << "Please enter the temperature in farenheit followed by enter\n";
   cin >> TEMPERATURE;
   }

I'd guess the message is something like this.

'TEMPERATURE' : undeclared identifier

I find that self-explanitory. There is no variable TEMPERATURE in the function TEMPinC.

The other one is the same issue, but different. You are using the pow function without including its header <cmath>.

One of many erros in your program that show up is that you did not enter TEMPERATURE in main or in the function,so the function does not know the varable name to access it. :cry:

You Also donot have a function or code for pow(),also it must be declair before main also. :(

This article has been dead for over six months. Start a new discussion instead.