// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include using namespace std; using std::cout; using std::cin; using std::endl; int convertC_to_F(int Ctemp) { float Ftemp; Ftemp = Ctemp * 1.8 + 32; return Ftemp; } int main() { string temptype; float Ftemp, Ctemp; cout << "enter F for Fahrenhiet or C for Celcius: "; cin >> temptype; if (temptype == "C") { while (true) { // take input from the user cout << "Enter a temperature in Celcius: "; cin >> Ctemp; if (Ctemp < -62 || Ctemp > 49.5) cout << "Celcius value must be between -62 and 49.5" << endl; else break; } //end C while Ftemp = convertC_to_F(Ctemp); cout << "Fahrenhiet temperature: "; cout << Ftemp; } else { while (true) { // take input from the user cout << "Enter a temperature in Fahrenheit: "; cin >> Ftemp; if (Ftemp < -81 || Ftemp > 121) cout << "Fahrenheit value must be between -81 and 121" << endl; else break; } // end F while } }