关于输入时没有数组数字个数的情况可以:
~scanf(没成功过)
!=EOF
cin和break(慢)
scanf 和break
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int x[105],c=0;
int main(){
for(int i=0;;i++){
cin>>x[i];
if(x[i]==0) break;
c=i;
}
for(int f=c;f>=0;f--) printf("%d ",x[f]);
return 0;
}
原文:https://www.cnblogs.com/liuziwen0224/p/11992459.html