Mn sửa giúp mk bài này vs. Nó k chạy đk là sao?
#include<iostream>
#define max 100
using namespace std;
typedef struct stack{
int top;
int node[max];
};
void Init(stack *s){
s->top=0;
}
int Empty(stack *s){
if(s->top==-1)
return 1;
return 0;
}
int Full(stack *s){
if(s->top== max-1)
return 1;
return 0;
}
void push(stack *s,int x){
if(!Full(s)){ //neu chua tran
s->top++;
s->node[s->top] =x;
}
else cout<<"tran ";
}
void Input(stack *s){
int n,x;
// while(n>max || n<1 ){
cout<<"\n Nhap so phan tu cua stack < "<<max<<" : ";
cin>>n;
// }
for(int i=0;i<n;i++){
cout<<" nhap ptu thu "<<i<<" ";
cin>>x;
push(s,x);
}
}
void output(stack *s){
for(int i=s->top-1;i>0;i--){
cout<<s->node[i]<<endl;
}
}
int main(){
stack *s;
int x;
Input(s);
output(s);
return 0;
}

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?