#include <stdio.h>
//判断两数中哪个大
int max(int x,int y)
{
if(x>y)
return 1;
else if(x==y)
return 2;
else
return 3;
}
int main(void)
{
int a=0,b=0;
int c=0;
printf("请输入两个整数:");
scanf("%d",a);
scanf("%d",b);
c=max(a,b);
switch(c)
{
case 1:printf("第一个数比第二个数要大。\n");
case 2:printf("两个数相等。");
case 3:printf("第一个数比第二个数要小。\n");
default:printf("请退出程序。\n");
}
system("pause");
return 0;
} 程序编译无错误,但运行到输入值就弹出“n内存不能为written”.求大神指教,本人菜鸟
//判断两数中哪个大
int max(int x,int y)
{
if(x>y)
return 1;
else if(x==y)
return 2;
else
return 3;
}
int main(void)
{
int a=0,b=0;
int c=0;
printf("请输入两个整数:");
scanf("%d",a);
scanf("%d",b);
c=max(a,b);
switch(c)
{
case 1:printf("第一个数比第二个数要大。\n");
case 2:printf("两个数相等。");
case 3:printf("第一个数比第二个数要小。\n");
default:printf("请退出程序。\n");
}
system("pause");
return 0;
} 程序编译无错误,但运行到输入值就弹出“n内存不能为written”.求大神指教,本人菜鸟

