Temperature Conversion in Value Returning

I am working in these codes but I am still getting error.

#include <iostream>
#include <string>
#include <conio.h>
#define ESC_KEY 0x1b
#define CELSIUS 0x43
#define FAHRENHEIT 0x46
using namespace std;

int main( void )
{
float temperature;
float* pt=&temperature;
do {
paintMenu();
switch (get_conversion_type()) {
case CELSIUS:
get_temperature("Celsius: ",pt);
convert_temperature(FAHRENHEIT,*pt);
break;
case FAHRENHEIT:
get_temperature("Fahrenheit: ",pt);
convert_temperature(CELSIUS,*pt);
break;

case ESC_KEY:
cout << endl;
break;
}
}
while (pauseProgram()!=ESC_KEY);
return 0x00;
}
void convert_temperature(char scaleType, float tmprValue)
{

cout << (scaleType==CELSIUS ? "Celsius: ":"Fahrenheit: ")
<< (scaleType==CELSIUS ? ((((40+tmprValue)*5)/9)-40):
(((40+tmprValue)*9)/5)-40)
<< endl;
}

void get_temperature(char *mssg, float *tval)

{

cout << "\n\nEnter a value...\n\n" << mssg;

cin >> *tval;

}



char get_conversion_type(void)



{

switch (_getch()) {

case 'c':
case 'C': return(CELSIUS);
case 'f':
case 'F': return(FAHRENHEIT);
case ESC_KEY: return(ESC_KEY);
default:
cout << "\n\nPlease press [C], [F], or [Esc]\n";
return 0x00;
}
}
char pauseProgram(void)
{
cout << "\n[Any] - Continue\n[Esc] - Exit";
switch(_getch()) {
case ESC_KEY: return(ESC_KEY);
default: return(0x00);
}

}

void paintMenu(void)
{

system("CLS");

cout << "\nTemperature Scale Conversion \n\n"

"Select your input value type...\n\n"

"\t [C] - Celsius\n"

"\t [F] - Fahrenheit\n\n"

"\t[Esc] - Exit\n\n"

"Press a [Key] ";

}
Topic archived. No new replies allowed.