简单编程设计

来源:百度知道 编辑:UC知道 时间:2024/06/09 09:22:15
编写一个字符菜单程序,功能自定
(可以是以前编写程序改成函数形式)。
功能自定义
要求:
1,至少要有3个功能
2,用C++语言
3,要是在一个程序内实现。
各位大虾加油啦。作业啊,十分急,在线等
806589798@qq.com
发到这上面,就采纳你的答案吧。谢谢

计算器程序你要么?我可以发到你邮箱里~我最近编的~

==================================
给你发了。尽快给分吧。。。

#include"stdio.h"
main()
{
int numa,numb,choice;
char ch;

printf("a. numa+numb \n");
printf("b. numa-numb \n");
printf("c. numa*numb \n");
ch=getchar();
printf("please input two number numa numb:\n");
scanf("%d%d",&numa,&numb);
if(ch=='a')
choice=1;
if(ch=='b')
choice=2;
if(ch=='c')
choice=3;
switch(choice)
{
case 1: printf("%d\n",numa+numb);break;
case 2: printf("%d\n",numa-numb);break;
case 3: printf("%d\n",numa*numb);break;
}

}