Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


trying to debug a second program and having trouble

posthimposthim Member Posts: 15
displays a Celsius temperature

using namespace std;

//function prototypes
int getFahrenheit();
float calcCelsius(int);
int displayCelsius();

int main()
//declare variables
int fahrenheit = 0;
float celsius = 0.0;

//get input item
fahrenheit = getFahrenheit();

//calculate Celsius
celsius = calcCelsius(fahrenheit);

//display output item
cout << fixed;
cout << "Celsius: " << celsius << endl;
return 0;
} //end of main function

//*****program-defined functions*****

int getFahrenheit()
int tempF = 0;
cout << "Enter Fahrenheit temperature: ";
cin >> tempF;
return tempF;
} //end of getFahrenheit function

float calcCelsius(int tempFahrenheit)
float tempC = 0.0;
tempC = 5.0 / 9.0 * (tempFahrenheit - 32);
return tempC;
} //end of calcCelsius function

int temp;
cout << "Dipl temp: ";//display the temperture calculated from fehrenheit to celsius
return temp;//return celsius temperature
} //end of dsiplayCelsius function


  • Geeth AsokanGeeth Asokan Member Posts: 127

    I replied to this thread on another message board!
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ____ { } free video tutorials and ebooks about || Scratch, Objective-C, MATLAB, Assembly, Python, Delphi, Perl, Go, Visual Basic, R, Visual Basic .NET, C#, C++, PHP, C, JavaScript, PL/SQL, Swift, Java, Ruby ABAP, Apex, Alice, Prolog, LabVIEW, Scheme, Ada, Awk, Scala, ML, Lua, Julia, SAS, F#, Lisp, Logo, FoxPro, Rust, Bash, Kotlin, COBOL, Erlang, VBScript, D, Clojure, Transact-SQL, Hack, Crystal, Dart, Fortran || ______

Sign In or Register to comment.