#include<iostream> using namespace std; int main(){ int stack[10],top=-1,n,i; if(top==9) cout<<"Stack is Full"; else{ cout<<"Enter the item to be inserted:"; cin>>n; top=top+1; stack[top]=n; } cout<<"You have inserted:"; cout<<stack[top]; return 0; }
No comments:
Post a Comment