#include <iostream>
#include <windows.h>
using namespace std;
void main() {
int option;
bool flag = 0;
float value, convert = 0;
//Note to myself, system is not compatible with *nix I think
system("title Temperature Convertions");
system("Color C");
cout <<
"Program that converts from Fahrenheit to Celsius or Celsius to Fahrenheit\n";
do {
cout <<
"Select one of this options: " << endl;
cout <<
"Type 1 if you wish to convert from Celsius to Fahrenheit" << endl;
cout <<
"Type 2 if you wish to Fahrenheit to Celsius" << endl;
cout <<
"Type 3 if you wish to exit" << endl;
cout <<
"What option would you take? : ";
cin >> option;
switch(option) {
case 1:
cout <<
"type the temperature in Celsius: ";
cin >> value;
cout <<
"The value in Fahrenheit would be: " <<
(convert =
(value *
9)/
5 +32) << endl;
flag = 1;
break;
case 2:
cout <<
"Type the temperature in Fahrenheit: ";
cin >> value;
cout <<
"The value in Celsius would be: " <<
(convert =
(value -
32) *
5/
9) << endl;
flag = 1;
break;
case 3:
cout <<
"See you next time\n";
flag = 1;
break;
default:
cout <<
"Incorrect option, please follow the instructions at the begining of the program";
Sleep(1000);
system("cls");
break;
}
}while(flag == 0);
system("pause");
}