|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 春秋八甲 于 2020-5-9 10:43 编辑
初学者,在看小甲鱼老师视频的时候有一个比较三个数大小的程序,但是我按照小甲鱼的视频原封不动地敲出来后发现。。它运行无结果。。到底是为什么呜呜呜,求各位大佬告知
#include<stdio.h>
int main()
{
int a,b,c,temp;
printf("Please input three numbers:\n");
scanf("%d %d %d",a,b,c);
if( a > b )
{
temp = a;
a = b;
b = temp;
}
if( a > c )
{
temp = a;
a = c;
c = temp;
}
if( b > c )
{
temp = b;
b = c;
c = temp;
}
printf("%d %d %d\n",a,b,c);
return 0;
}
学编程最重要的是细心,第7行,scanf那里,&呢?
- #include<stdio.h>
- int main()
- {
- int a,b,c,temp;
- printf("Please input three numbers:\n");
- scanf("%d %d %d",&a,&b,&c);
- if( a > b )
- {
- temp = a;
- a = b;
- b = temp;
- }
- if( a > c )
- {
- temp = a;
- a = c;
- c = temp;
- }
- if( b > c )
- {
- temp = b;
- b = c;
- c = temp;
- }
- printf("%d %d %d\n",a,b,c);
- return 0;
- }
复制代码
|
|