#2019120500018-LG 小雨的数字游戏

洛谷P1427 小鱼的数字游戏

关于输入时没有数组数字个数的情况可以:

~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;
}
posted @ 2019-12-05 22:20  刘子闻  阅读(92)  评论(0)    收藏  举报