Event Loop Nesting Exercise:
- Click to get a copy of the
Use your mouse to copy and paste the program into Visual Studio or XCode.
- Compile and run the program. It should seem familiar - this is one possible solution to the Fahrenheit-Celsius program you saw earlier this semester.
- Add a do-while loop to ask the user enter data until they say they are done.
Follow the ADD CODE: instructions in the program. They will guide you through the following tasks:
- Start the loop before the menu is printed.
- End the loop after the results are printed and before the final return statement.
- Before the loop ends, and after results are printed ask the user if the want to convert another temperature. eg:
Do you want to convert another temperature? (y/n)
- The loop should repeat while their answer is 'y'.
- Add a while loop nested inside the do-while loop. It will
replace the if-else that makes sure that a valid letter is entered before
calculating. The while loop should repeat until a valid letter is entered.
Use your judgement to do it correctly.
Copyright: Department of Computer Science, University of Regina.