Lesson issues

I'm trying to do this on my own, just started taking a class and need help. Here is the code and the error msg

#include <iostream.h>

double celsius_to_fahrenheit(double celsius);


double get_celsius();




int main()
{
double fahrenheit;
double celsius;
double celsius_in;

celsius = get_celsius();



cout << "Enter the temprature in Celsius: ";
fahrenheit = celsius_to_fahrenheit(celsius);

cout << celsius << " C = " << fahrenheit << " F\n";

return 0;
}

double celsius_to_fahrenheit(double celsius)
{
return(celsius * (9.0/5.0) + 32.0);
}

double get_celcius()
{
double celcius_in;

cout << "Enter the temperature in Celsius: ";
cin >> celsius_in;
return celsius_in;
}

: warning C4101: 'celsius_in' : unreferenced local variable
: error C2065: 'celsius_in' : undeclared identifier
Error executing cl.exe.

ctof.obj - 1 error(s), 1 warning(s)

Any help would be great!
First of all, when posting code, please use the [ code ] code here [ /code ] tags. It makes it much easier to read.

And look through your code, you have different versions of the word celsius/celcius!!

And the warning, this is because a variable has no value. It's good practise to initialse a variable with a value:
1
2
3
double fahrenheit = 0;
double celsius = 0;
double celsius_in = 0;
closed account (z05DSL3A)
1
2
3
4
5
6
7
8
double get_celcius()
{
double celcius_in;

cout << "Enter the temperature in Celsius: ";
cin >> celsius_in; 
return celsius_in;
}


<----\
     |
     |
<----|
<----/


Spelling!
Spelling Spelling Spelling Thank you that worked next time before I post I will check and triple check my spelling.

K.S.
Topic archived. No new replies allowed.