//write a program that will convert from degrees Centigrade to degrees Fahrenheit
//and converts from F to C.  There should be a console menu for choosing which
// conversion to do and a third option to finish the program.
//F= 32+9/5*C.    Test C=0;C=-40; C=100;
//C=(F-32)*5/9

//Demonstrates pass by value and return values
#include <iostream>
using namespace std;
//function prototypes
float cToF(float);
float fToC(float);
int main(void)
{
	float Cent;  //centigrade
	float Fahr; //fahrenheit
	int choice = 1;
	while (choice != 3)
	{
		cout << "please enter choice" << endl;
		cout << "1:Cent to Fahren\n";
		cout << "2:Fahren to Cent\n";
		cout << "3:exit\n";
		cin >> choice;

		if (choice == 1)
		{
			cout << "please enter temp (degrees C)" << endl;
			cin >> Cent;
			Fahr = cToF(Cent); //pass by value
			cout << "Temp in F is " << Fahr << endl;
			

		}
		if (choice == 2)   //>, <, >=,  <=  &&, ||, &, |
		{
			//F->C
			cout << "please enter temp (degrees F)" << endl;
			cin >> Fahr;
			Cent = fToC(Fahr);
			cout << "Temp in C is " << Cent << endl;


		}
		if (choice == 3)
		{
			//end program
			cout << "Bye\n";
		}
		system("pause");
		system("cls");
	}
	return 0;
}

float cToF(float C)
{
	return 32.0 + 9.0 / 5.0*C;	
}
float fToC(float F)
{
	float C;
	C = 5.0*(F - 32.0) / 9.0;
	return C;
}
