gpt4 book ai didi

c - 程序在输入输入之前结束(开关盒)

转载 作者:太空宇宙 更新时间:2023-11-04 02:02:12 26 4
gpt4 key购买 nike

<分区>

我是 C 编程的新手我写一个程序。但是当我在输入之前运行程序时,我的选择程序结束了。这是屏幕截图。 https://onedrive.live.com/download?resid=E63780628DD96583!3161&authkey=!APl3ReO7T4XIO_s&v=3&ithint=photo,jpg

#include<stdio.h>
#include<conio.h>
main()
{
char ch;
int num1, num2, a, m, s;
float d;
printf("\nEnter The First Number: ");
scanf("%d", &num1);
printf("\nEnter The Second Number: ");
scanf("%d", &num2);
a=num1+num2;
m=num1*num2;
s=num1-num2;
d=(float)(num1/num2);
printf("\nEnter Your Choice: ");
scanf("%c", &ch);
switch(ch)
{
case 'A': printf("\nThe Addition Of The Number Is= %d", a);
break;
case 'M': printf("\nThe Multipication Of The Numbers Is= %d", m);
break;
case 'S': printf("\The Subsraction Of THe Numbers Is= %d", s);
break;
case 'D': printf("\nThe Division Of The Two Numbers Is= %f", d);
break;
default : printf("\nInvalid Entry");
break;
}
getch();
return 0;
}

我哪里做错了???

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com