Chinaunix首页 | 论坛 | 博客

分类: 信息化

2014-11-24 16:26:26


/* ************************************************************ 
       NAME      :          LISHUBO                           
  AUTHOR    :          SDF                                 
  DATE      :          2014-11-19                       
  注释      :          这是c程序,他的功能是输入一些数字,达到运算的效果。
*************************************************************** */
#include 
float g=0,c=0; 
void main() 
{ 
void one(); 
void two(); 
void three(); 
void four(); 
void five(); 
int t; 
do 
{ 
one(); 
printf("menu:\n"); 
printf("1.yunsuan\n2.Save \n3.Delete\n4.Exit\n"); 
scanf("%d",&t); 
if("t==1||t==2||t==3||") one(); 
else two(); 
switch(t) 
{ 
case 1:printf("1.yunsuan:");three();break; 
case 2:printf("2.Save:");four();break; 
case 3:printf("3.Delete:");five();break; 
default:break; 
} 
} 
while(t<4||t>4); 
} 
void one() 
{ 
printf("look:\n"); 
} 
void two() 
{ 
printf("Error!!!\n"); 
} 
void three() 
{ 
float a,b,c; 
int s; 
printf("Menu:\n"); 
printf("1.add(+)\n2.sub(-)\n3.mul(*)\n4.rem(/)\n"); 
scanf("%d",&s); 
if(s==5) two(); 
else 
printf("input two number:\n"); 
if(s==1) 
{ 
scanf("%f %f",&a,&b); 
c=a+b; 
printf("Sum is %f\n",c); 
g=c+g; 
} 
else if (s==2) 
{ 
scanf("%f %f",&a,&b); 
c=a-b; 
printf("Differ is %f\n",c); 
g=c+g; 
} 
else if(s==3) 
{ 
scanf("%f %f",&a,&b); 
c=a*b; 
printf("Amass is %f\n",c); 
g=c+g; 
} 
else if(s==4) 
{ 
scanf("%f %f",&a,&b); 
if(b==0) two(); 
else 
c=a/b; 
printf("Trade is %f\n",c); 
g=c+g; 
} 
} 
void four() 
{ 
g=g+c; 
printf("%f\n",g); 
} 
void five() 
{ 
g=c-c; 
printf("%f\n",g); 
} 

如图:



阅读(1503) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~