level 9
离子球
楼主
main()
{
float x,y;
float jg;
char ch;
printf("请输入两个整型数:");
scanf("%f%f",&x,&y);
printf("请输入运算符号:");
ch=getchar();
switch(ch)
{
case '+': jg=x+y;break;
case '-': jg=x-y;break;
case '*': jg=x*y;break;
case '/': jg=x/y;break;
default : printf("\n你输入的字符不符合要求!");
}
if(ch=='+'||ch=='-'||ch=='*'||ch=='/');
printf("\n %0.1f%c%0.1f=%0.1f",x,ch,y,jg);
getch();
}
2012年11月11日 09点11分
1
{
float x,y;
float jg;
char ch;
printf("请输入两个整型数:");
scanf("%f%f",&x,&y);
printf("请输入运算符号:");
ch=getchar();
switch(ch)
{
case '+': jg=x+y;break;
case '-': jg=x-y;break;
case '*': jg=x*y;break;
case '/': jg=x/y;break;
default : printf("\n你输入的字符不符合要求!");
}
if(ch=='+'||ch=='-'||ch=='*'||ch=='/');
printf("\n %0.1f%c%0.1f=%0.1f",x,ch,y,jg);
getch();
}
