谁能告诉我错在那#include"stdio.h"void main (){int a c;char b;printf("请输入两个变量:");scanf("%d%d"&a,&c);printf("请输入一个字符:");scanf("%c"&b);if(b=='+');printf("a+c=result"\n,=result);if(b=='-');printf("a-c=result"\n,=result
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/12 13:44:23
谁能告诉我错在那#include"stdio.h"void main (){int a c;char b;printf("请输入两个变量:");scanf("%d%d"&a,&c);printf("请输入一个字符:");scanf("%c"&b);if(b=='+');printf("a+c=result"\n,=result);if(b=='-');printf("a-c=result"\n,=result
谁能告诉我错在那
#include"stdio.h"
void main ()
{
int a c;
char b;
printf("请输入两个变量:");
scanf("%d%d"&a,&c);
printf("请输入一个字符:");
scanf("%c"&b);
if(b=='+');
printf("a+c=result"\n,=result);
if(b=='-');
printf("a-c=result"\n,=result);
if(b=='*');
printf("a*c=result"\n,=result);
if(b=='/');
printf("a/c=result"\n,=result);
}
#include"stdio.h"
void main ()
{
int a c;
char b;
printf("请输入两个变量:");
scanf("%d%d",&a,&c);
printf("请输入一个字符:");
scanf("%c",&b);
if(b=='+')
printf("a+c"\n,a+c);
eles if(b=='-')
printf("a-c"\n,a-c);
eles if(b=='*')
printf("a*c"\n,a*c);
eles if(b=='/')
printf("a/c"\n,a/c);
}
谁能告诉我错在那#include"stdio.h"void main (){int a c;char b;printf("请输入两个变量:");scanf("%d%d"&a,&c);printf("请输入一个字符:");scanf("%c"&b);if(b=='+');printf("a+c=result"\n,=result);if(b=='-');printf("a-c=result"\n,=result
错了不少~
#include"stdio.h"
void main ()
{
int a,c;
char b;
printf("请输入两个变量:");
scanf("%d%d",&a,&c);
printf("请输入一个字符:");
fflush(stdin);
scanf("%c",&b);
fflush(stdin);
if(b=='+')
printf("a+c=%d\n",a+c);
if(b=='-')
printf("a-c=%d\n",a-c);
if(b=='*')
printf("a*c=%d\n",a*c);
if(b=='/')
printf("a/c=%f\n",a/(float)c);
}