| | |
New 2 C++, help with finding erros
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2004
Posts: 3
Reputation:
Solved Threads: 0
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";
}
#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";
}
[Whoa. I'd suggest ending your preference of CAPITALIZING SYMBOLS.]
Read the error messages.
I'd guess the message is something like this.
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>.
Read the error messages.
C++ Syntax (Toggle Plain Text)
void TEMPinC() { cout << "Please enter the temperature in farenheit followed by enter\n"; cin >> TEMPERATURE; }
•
•
•
•
'TEMPERATURE' : undeclared identifier
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
![]() |
Similar Threads
- Help finding modem driver for laptop (Windows NT / 2000 / XP)
- program for finding factorial of a number using *operator overloading (C++)
- Finding an IP address using Java (was: do u know?) (Java)
- finding area of something (Computer Science)
- Finding Encrypted Files (Windows tips 'n' tweaks)
Other Threads in the C++ Forum
- Previous Thread: Halp in breaking a loop
- Next Thread: Help for a Specialised project
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamic dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template templates test text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






