scanf函数的问题
想用while语句和getchar()函数输入一个数组,输入数组后再回车,为什么不能显示“press any key to continue”表示输入成功呢?我的代码到底错在哪里?请高手帮看一下。#include<stdio.h>
void main()
{
int i,a[100];
i=0;
while(getchar()!='\r')
{
scanf("%d",&a[i]);
i++;
}
}
2013-09-23 16:44

2013-09-23 18:03
2013-09-23 20:44
2013-09-23 20:48
2013-09-23 21:13
2013-09-23 22:02
2013-09-24 17:14
2013-09-24 17:15