I'm not sure what to do, kinda stuck so need your help.
- I need to write a boolean function, Error, that takes letter and returns true if
letter is not uppercase C,F, or Q and false otherwise.
- If letter is not correct, write an error message and prompt again to enter the
right letter. That's all.
I need to run the program with c 0 and X 100 and check results for both.
I know when i type c i should get an error prompt and when I type X to get a prompt to write the right letter, but not sure how.
Here is the program I have so far:
#include <iostream>
using namespace std;
int ConvertedTemp(int tempIn, char letter);
// If letter is a 'C,' tempIn is converted from Celsius
// to Fahrenheit; otherwise tempIn is converted from
// Fahrenheit to Celsius.
int main ()
{
char letter; // Place to store input letter
int tempIn; // Temperature to be converted
cout << "Input Menu" << endl << endl;
cout << "F: Convert from Fahrenheit to Celsius" << endl;
cout << "C: Convert from Celsius to Fahrenheit" << endl;
cout << "Q: Quit" << endl;
cout << "Type a C, F, or Q; then press return." << endl;
cin >> letter;
while (letter != 'Q')
{
cout << " Type an integer number, and press return."
<< endl;
cin >> tempIn;
Well once when the program is done and when i run it, it asks to either type C (celsius) or the others and then asks for an integer, and then it just converts to Fah. or vice versa. But that's only while running the program.