122 lab week 4 |
What You Will Do In Your LabEOF-Controlled while loopHere's an example of a I/O driver loop in main() that interacts with the user. The user enters a C. temperature and the program displays the corresponding F. temperature: //Example: EOF-controlled loop //prompt and read //EOF-controlled driver loop-- convert C. temps to F. temps This is can be improved through the use of a value-returning function that meets this spec: /* changeC2F() ----------------------------------- Given this function, one can rewrite the loop: //EOF-controlled driver loop-- convert C. temps to F. temps NOTE that the driver loop does the I/O, not the function. The loop reads a value, passes it to the function in a function call, and then prints the value returned by the function. The general rule is that value-returning functions do not use cin and do not use cout. Lab ExerciseYour lab instructor will help you with the following:
|