#include<stdio.h>
void main()
{
int a[50];
int i=0,j=0;
int temp;
printf("请输入数据,中间用空格间隔,用回车结束输入:\n");
do
{
scanf("%d",&a[i++]);
}while(getchar()()!='\n');
//首尾交换
temp =a[0];
a[0] =a[i-1]
a[i-1] = temp;
///输出
for(j=0;j<i;j++)
{
printf("%3d ",a[j]);
}
printf("\n");
}
///输入的时候这样输入: 1空格2空格3空格4回车
追问while哪一行 error C2064: term does not evaluate to a function
追答那换成
while(getchar() !='\n'); 吧