New 2 C++, help with finding erros

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2004
Posts: 3
Reputation: HinJew is an unknown quantity at this point 
Solved Threads: 0
HinJew HinJew is offline Offline
Newbie Poster

New 2 C++, help with finding erros

 
0
  #1
Sep 28th, 2004
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";
}
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,433
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 249
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: New 2 C++, help with finding erros

 
0
  #2
Sep 28th, 2004
[Whoa. I'd suggest ending your preference of CAPITALIZING SYMBOLS.]

Read the error messages.
  1. void TEMPinC()
  2. {
  3. cout << "Please enter the temperature in farenheit followed by enter\n";
  4. cin >> TEMPERATURE;
  5. }
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 the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 11
Reputation: Chester1 is an unknown quantity at this point 
Solved Threads: 0
Chester1 Chester1 is offline Offline
Newbie Poster

Re: New 2 C++, help with finding erros

 
0
  #3
Sep 28th, 2004
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:
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 11
Reputation: Chester1 is an unknown quantity at this point 
Solved Threads: 0
Chester1 Chester1 is offline Offline
Newbie Poster

Re: New 2 C++, help with finding erros

 
0
  #4
Sep 28th, 2004
You Also donot have a function or code for pow(),also it must be declair before main also.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC