题目传送门

#include <bits/stdc++.h>

using namespace std;
const int N = 110;
int a[N];

int main() {
    int idx;
    //数字0时终止输入
    for (idx = 0;; idx++) {
        cin >> a[idx];
        if (a[idx]==0) {
            //最后一个a[i]是零啊!为啥是i-1,因为在上面的循环中,最后一次i++了。
            idx--;
            break;
        }
    }
    for (int j = idx; j >= 0; j--) cout << a[j] << " ";
    return 0;
}

相关文章:

  • 2021-09-17
  • 2022-01-12
  • 2021-09-10
  • 2022-01-22
  • 2021-11-28
  • 2021-06-15
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2021-12-10
  • 2021-12-21
  • 2021-10-11
相关资源
相似解决方案