Question: i'm using a text editor Exercise of If-Then-Else Statment: Get a copy of the convert.cpp file by: o Entering the cp command in hercules: cp

i'm using a text editor  i'm using a text editor Exercise of If-Then-Else Statment: Get a
copy of the convert.cpp file by: o Entering the cp command in

Exercise of If-Then-Else Statment: Get a copy of the convert.cpp file by: o Entering the cp command in hercules: cp et/data/ftp/pub/class/110/ftp/cpp/if/convert.cpp convert.cpp o or, using your mouse to copy and paste the program into Nano text editor or Visual C++. This program demonstrates how to use if-else statement. Test the program with these inputs: c 100 F 32 c0 fo d0 Explain to yourself: o Why do the last three sets of the input values yield the same output? o Why isn't c the same as C? . Why would you type any number after d even though d is not a known conversion type? . You should use two if-else structures to fix the program: o One will validate the letter as soon as it is typed: If the input letter is not C, C, F, or f, output "wrong letter". then use an else to skip the rest of the program (do not ask for temperature, do not print result) Do not return early. o The other will choose what conversion to use. Make sure to treat (C 100) and (c 100) the same, and treat (F 32) and (f 32) the same; 1/1 Program Convert converts a temperature in Fahrenheit to // Celsius or a temperature in Celsius to Fahrenheit // depending on whether the user enters an F or a c.. #include using namespace std; int main() char letter; int tempIn; int tempOut; // Place to store input letter // Temperature to be converted // Converted temperature cout > letter; cout cin > tempin; if (letter - 'C') tempOut - (9* tempin / 5) + 32; else tempout - 5. (tempin - 32) / 9; cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!