能帮我看看这那出错了吗?
#include<bits/stdc++.h>
using namespace std;
const int N = 1000010;
char stk[N],t = 0,n;
void push(char x){
stk[++t] = x;
}
void pop(){
t--;
}
int top(){
return stk[t];
}
bool stkEmpty(){
return t==0;
}
void stkDisplay(){
int i = t;
while(i!=0){
cout<<stk[i--]<<" ";
}
cout<<endl;
}
int main() {
char x;
while(cin>>x){
push(x);
}
while(!stkEmpty()){
cout<<top();
pop();
}
return 0;
}
输入样例:asdfghjkl123456
输出样例:654321lkjhgfdsa