1、include
#include
#include
#include
float cheng(float a,float b);
logon()
{
printf("\t\t 简易计算器\n");
printf("\n\n");
printf("\t\t 制作者:风送来你的背影 \n");
printf("\t\t 日期:2012年06月16号\n");
system("pause");
}
f1_main()
{
float a,b,c;
ch
2、ar ch;
scanf("%f",&a);
scanf("%c%f",&ch,&b);
switch(ch)
{
case '+': c = a + b; break;
case '-': c = a - b; break;
case '*': c = a * b; break;
default : c = a / b; break;
}
printf("%.3f\n",c);
system("pause");
}
f2_main()
{
float a,b,c;
char ch;
scanf("%f%c%f",&a,&ch,
3、b);
switch(ch)
{
case '&': c=cheng(a,b); break;
case '^': c=pow(a,1.0/b); break;
}
printf("%.3f",c);
system("pause");
}
f3_main()
{
float s=0,n;
int i,j;
printf("请输入数据总数:");
scanf("%d",&j);
for(i=0;i4、的平均值为:%.3f",s,s/j);
system("pause");
}
f4_main()
{
int i,j,s=1;
scanf("%d",&i);
for(j=1;j<=i;j++)
s=s*j;
printf("%d的阶乘结果为:%d\n",i,s);
system("pause");
}
f5_main()
{
printf("本程序有风送来你的背影制作。");
printf("功能不是很完善,请大家多多指教。\n");
system("pause");
}
float cheng(float a,float
5、 b)
{
int i,s=1;
for(i=0;i
6、ntf("————请按要求进行运算————\n");
int select;
do{
scanf("%d",&select);
if(select>=6||select<0)
{
printf("输入错误!\n");
printf("请在0 - 5 之间输入指令。 ");
scanf("%d",&select);
}
switch(select)
{
case 1:f1_main();break;
case 2:f2_main();break;
case 3:f3_main();break;
case 4:f4_main();break;
case 5:f5_main();break;
default:exit(0);break;
}
}
while(select);
}