多组输入的语句(我在这栽倒了很多次很烦诶)

这是书上的一道例题。
#include<stdio.h> int main() { void s(int *p1,int *p2); int a,b; int *o1,*o2; while(scanf("%d %d",&a,&b)!=EOF) 对就是这里!!!!!多组数据输入可以循环比较!记得while后面的大括号要紧跟循环体,没有大括号的话就没有输出的(我经常错这里),还有啊,while后加分号了也会没有输出的!! { o1=&a; o2=&b; if(a<b) s(o1,o2); printf("%d>%d\n",a,b); } return 0; } void s(int *p1,int *p2) { int c; c=*p1; *p1=*p2; *p2=c; }

 

posted @ 2017-12-11 20:39  RAIN-code  阅读(142)  评论(0编辑  收藏  举报