This is a assignment for my programming class and i can't seem to figure out why it's not working. getting two errors.
error C2065: 'resultCF' : undeclared identifier
error C2065: 'resultFC' : undeclared identifier
here's the code..
#include <iostream>
using namespace std;
float CtoF(float);
float FtoC(float);
int main()
{
int choice;
float degF, degC;
bool startOver = true;
do
{
cout << "Please select from the following: \n";
cout << "Celsius-to-Fahrenheit [1], Fahrenheit-to-Celsius[2], Quit [3]: ";
cin >> choice;
if ((choice > 3) || (choice <= 0))
{
do
{
cout << "Incorrect choice. Try again.\n";
cout << "Please select from the following: \n";
cout << "Celsius-to-Fahrenheit [1], Fahrenheit-to-Celsius[2], Quit [3]: ";
cin >> choice;
}while ((choice > 3) || (choice <= 0));
}
if (choice == 1)
{
cout << "Enter the temperature value in degrees C to convert: ";
cin >> degC;
cout << "\nThe temperature you entered in C, " << degC << " is " << resultCF << " F\n\n";
}
if (choice == 2)
{
cout << "Enter the temperature value in degrees F to convert: ";
cin >> degF;
cout << "\nThe temperature you entered in F, " << degF << " is " << resultFC << " C\n\n";
}
if (choice == 3)
{
cout << "Goodbye!!!\n";
startOver = false;
}
}while (startOver == true);
return 0;
}
float CtoF(float degC)
{
float resultCF;
resultCF = 5.0*(degC-32.0)/9.0;
return resultCF;
}
float FtoC(float degF)
{
float resultFC;
resultFC = ((9.0/5.0)*degF)+32.0;
return resultFC;
}