fungetch.cpp

来自「c语言教程源码」· C++ 代码 · 共 21 行

CPP
21
字号
//这个程序在本书所带软盘中,文件名为fungetch.cpp
//这个子程序演示利用getch()或getche()来接受用户的菜单选择项目。

/************* 子程序 menu() ***********************************/

int menu(void)          //在屏幕上显示菜单
{
    int select;

	clrscr();           //清屏

	cout <<setw(40) << "打入 a 执行选择项目1" << endl;
	cout <<setw(40) << "打入 b 执行选择项目2" << endl;
	cout <<setw(40) << "打入 c 执行选择项目3" << endl;
	cout <<setw(40) << "打入 q 退出程序执行 " << endl << endl;
	cout <<setw(40) << "请打入你的选择项目: ";
	select = getch();   //或 select = getche();

	return select;
}                       //子程序menu()结束

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?