【发布时间】:2021-12-15 03:50:25
【问题描述】:
这是我在这里的第一篇文章。 我本月开始学习软件工程,我正在尝试使用 c 编写软件。 我找不到改变它的错误.. 谁能帮帮我!
#include <stdio.h>
void main()
{
int a,b,e;
char operation;
printf ("enter the first number:");
scanf ("%d",&a);
printf ("enter the second number:");
scanf ("%d",&b);
printf ("enter the operation:");
scanf ("%c", &operation);
switch (operation)
{ case '+' : e=a+b;
break;
case '-' : e=a-b;
break;
case '*' : e=a*b;
break;
case '/' : e=a/b;
break;
default: printf("wrong choice!!");
}
printf("%d %c %d = %d \n", a, operation, b, e);
}
【问题讨论】:
-
您在尝试执行程序时收到什么错误?
-
提示:检查
c的值 -
C:\Users\JAOUADI\Desktop\C>最大输入第一个数字:5输入第二个数字:6输入操作:错误选择!!5 6 = 464950
-
请使用tour 并阅读How to Ask。你的 questin 太让人猜不透了。它基本上是“嗨。代码”。
标签: c switch-statement