/** copyright (c) 2012, Emy of computer science, Yantai University * All Rights Reserved. * Author: Zhao guanzhe * Completion Date: July 15, October 30, 2012 * version number: V1.0 ** enter Description: none * Problem description: doubebean * Program output: Eat? Sleeping? Beans? * Problem Analysis: Use the switch statement to rewrite * algorithm Design: omitted */# include
using namespace STD; int main () {int A; do {cout <"* 1. dinner "
A; if (a> 3) cout <" \ 007 select error! "
Running result:
Experience:
Using the switch statement, I personally think that the user-defined function is easier than Mr. He's, but I want to learn the User-Defined Function in the next chapter!
Knowledge Point summary:
Pay attention to the use of curly brackets and end with "Congratulations! You have finished a job !" It must be placed in a proper position. If you make a mistake, it is very likely that after "incorrect selection" is output, "Congratulations !"