Hello, I recently started taking classes in c++, and one of our assignments is to create a program that converts Fahrenheit to Celsius degrees. I was able to do so, however I want to make the conversion part into a subprogram, I have some idea on how to write it, but whenever I do it crashes or something bad happens. Any help is appreciated thanks.
#include <iostream>
#include <iomanip>
using namespace std;
float FahrenheitToCelcius(float fahrenheit);
int main()
{
float fahrenheit;
float celsius;
int choice;
float FahrenheitToCelsius;
do{
cout << "This program converts fahrenheit to celsius" << endl << endl ;
cout << "Please Enter Fahrenheit Degrees: ";
cin >> fahrenheit;
cout << "Your Conversion Is: "<< fahrenheit << " Degree Fahrenheit to:" << endl;
cout << FahrenheitToCelsius << fixed << setprecision(2) <<" Degrees Celsius.";
cout << "Want To Play Again?";
cout << "1 == Yes";
cout << "2 == No " << endl;
cin >> choice;
} while (choice == 1);
cin.get();
return 0;
}
float FahrenheitToCelcius(float celsius, float fahrenheit)
{
celsius = (5.0/8.0) * (fahrenheit - 32);
return celsius;
}