C++编写一个菜单显示程序
#include <iostream>#include <cstdlib>void print() { std::cout << "******************" << std::endl << "*1
*" << std::endl << "*2
*" << std::endl << "*3
" << std::endl << "*0
*" << std::endl << "******************" << std::endl << std::endl;}char request() { std::cout << "
<< std::endl << std::endl; std::string s; std::cin >> s; return s[0];}int check(char c) { switch (c) { case '1': case '2': case '3': std::cout << "
" << c << std::endl; break; case '0': std::cout << "
" << c << std::endl; exit(0); default: std::cout << "
<< c << std::endl; break; }}int main(int argc, char** argv) { print(); while (true) { char c = request(); check(c); } return 0;