| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 409 人关注过本帖
标题:谁能帮我将以下简单的C程序改成下拉菜单式的!
只看楼主 加入收藏
海浪__2009
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-9-11
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
谁能帮我将以下简单的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.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");
printf("\n");
printf("\n");
printf("\n");
printf("      ************************************************* \n");
printf("      |              Thank you for using              |\n");
printf("      ************************************************* \n");
printf("\n");
printf("\n");
printf("\n");
printf("      please wait for a few seconds to exit the program");
Sleep(3000);
system("cls");
exit(0);break;
  default:printf("please output the  right number\n");goto loop;
              }
  getchar();getchar();system("CLS");
  goto loop;
}
else printf("the code is error\n");goto loop2;
}  
搜索更多相关主题的帖子: 菜单 
2009-09-14 21:39
地狱无明火
Rank: 2
等 级:论坛游民
帖 子:62
专家分:71
注 册:2009-6-11
收藏
得分:20 
下拉菜单。。。如果是我应该会动用图形函数吧
2009-09-16 03:29
快速回复:谁能帮我将以下简单的C程序改成下拉菜单式的!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016179 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved