谁能帮我将以下简单的C程序改成下拉菜单式的!
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <windows.h>#define pi 3.14159 double volum3(double s,double h) {return 1... 展开
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <windows.h>#define pi 3.14159 double volum3(double s,double h) {return 1.0/3*s*h;} double area2(double a,double b) { double s1,s2;s1=2.0*pi*a*b;s2=pi*a*a;return s1+s2;} double area1 (double a,double b) {double s1,s2;s1=pi*a*sqrt(a*a+b*b);s2=pi*a*a;return s1+s2;} double volume1 (double a,double b) {double v;v=pi*a*a*b*1.0/3;return v;} main() {int t,p,i=0;double s1,s2,s3,v1,v2,v3,r1,h1,r2,h2,h3;loop2: printf("please press the code(two thousands and nine):");scanf("%d",&p);if(p==2009) { getchar();system("CLS");for(i=0;i <1;i++) printf("\n");printf("\n");printf("\n");printf("\n");printf("welcome to you\n\n");Sleep(3000);system("cls");loop: printf("==================================\n");printf("|1.the Calculation of cones |\n");printf("==================================\n");printf("|2.the Calculation of cylinders|\n");printf("==================================\n");printf("|3.the Calculation of pyramids|\n");printf("==================================\n");printf("|0. exit the program |\n");printf("==================================\n");scanf("%d",&t);system("cls");switch(t) {case 1:printf("please output of the bottom radius of cone\n");scanf("%lf",&r1);if(r1 <=0) {printf("error");goto loop;} printf("please output of the high of cone\n");scanf("%lf",&h1);if(h1 <=0) {printf("error");goto loop;} v1=volume1 (r1,h1);s1=area1(r1,h1);printf("the volum is %f\n the area is%f\n",v1,s1);break;case 2:printf("please output of the bottom radius of the cylinder\n");scanf("%lf",&r2);if(r2 <=0) {printf("error");goto loop;} printf("please output of the high of cylinder\n");scanf("%lf",&h2);if(h2 <=0) {printf("error");goto loop;} v2=3*volume1(r2,h2);s2=area2(r2,h2);printf("the volum is %lf\n the area is%lf\n",v2,s2);break;case 3:printf("please output the footprint of pyramid\n");scanf("%lf",&s3);printf("please output of the high of pyramid\n");scanf("%lf",&h3);if(s3 <=0) {printf("error");goto loop;} v3=volum3(s3,h3);printf("the volum is %lf\n ",v3);break;case 0: for(i=0;i <1;i++) printf("\n"收起
其他答案
目前我想到的是:不能是基于控制台的程序了,会比较麻烦,你的所有输入要通过编辑框获得,不能再用scanf,printf等语句,要创建一个win32Application 或者MFC工程比较好。太麻烦的工程了,给你推荐一本《windows程序设计第五版》书,我还是占座等更好的答案吧。
2011-01-18 07:07
来自北京市
赞(0)点赞赞(0)举报
发布评论
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。
相关问题
- 1回答 帮写个C++简单程序
- 1回答 简单的单片机c程序
- 2回答 一个超级简单的C程序
- 1回答 帮忙看这C程序错哪里,挺简单的
- 1回答 C语言编写简单数学公式的问题
- 1回答 C++有个简单的程序我不知道为什么不加break输出的结果和加了以后的结果不一样
- 2回答 房产的过户、赠与、继承,这3种方式哪个交税和手续费最少?哪个办理程序最简单?分别介绍一下。
- 1回答 一个简单的c++程序
- 2回答 用c++设计一个计算器模拟程序,要求对包含加、减、乘、除、括号运算符及sqr和abs函数的任意整型表达式进行
- 2回答 如何把敞开式的书房改成房间?有没有什么最简单且美观的材料把书房变成睡房呢?
- 1回答 增值税,项目地已按简单计税方式预交了3个点,某些原因得改成一般计税方式,外地预交2个点,我得怎么做
- 1回答 定义:①招标指招标人在买卖大宗商品、发定义:①招标指招标人在买卖大宗商品、发包建设项目或合作经营某项业务前,不经过一般交易磋商程序,而是公开征求应征人递盘竞争,最后由招标人选定交易对象订约的交易方式。②标的指招标方在公开招标前根据其近年来的情况,并充分考虑企业的资金有机构成和固定资产状况,以及生产、市场情况与经营环境等因素,通过测算所确定的最低招标基数。③租赁指出租人(或租赁公司)用自有资金或向银行借款购置设备,出租给承租人在约定时间内使用,承租人依约付给出租人一定租金的一种经营方式。租赁期内出租人拥有设备所有权,承租人则拥有使用权,并在租赁期届满时有权作出续租、退租或购留的选择。典型行为:(1)某市第三建筑工程公司在银鑫房地产公司计划开发的“银鑫花园”公开招标时,通过对其他投标方的观察确定了己方竞标基数为3130万元。(2)某市政府为修建中心农贸市场,发布通告,征求具有二级资质以上的单位前来竞标。(3)乙方在承租甲方的60平方米住房及配套生活设施后,将甲方房内的洗衣机、电视机等都卖掉了。上述典型行为与定义存在对应关系的数目有( )。 A. 0个 B. 1个 C. 2个 D. 3个
回答成功


