求救
查看原帖
求救
993368
JshGLJ楼主2023/9/22 22:07
#include<iostream>
#include<stack>
using namespace std;
int main(){
    stack<int> s;
    while(true){
        int a;
        cin>>a;
        s.push(a);
        if(s.top() == 0){
            break;
        }
    }
    while(true){
        if(s.top() != 0){
            int n=s.top();
            cout<<n<<" ";
            s.pop();
        }else{
            return 0;
        }
    }
    return 0;
}
2023/9/22 22:07
加载中...