Uruk.Ruqa
RuRu
plain_text
2 months ago
515 B
7
Indexable
#include<iostream>
using namespace std;
int q[10],f=-1,r=-1,c,v;
int main(){
while(1){
cout<<"\n1)Ins 2)Del 3)Disp 4)Exit\n";
cin>>c;
if(c==4)break;
if(c==1){if(r==9)cout<<"Overflow\n";else{cin>>v;q[++r]=v;if(f==-1)f=0;}}
else if(c==2){if(f==-1)cout<<"Underflow\n";else{cout<<"Del:"<<q[f]<<"\n";if(f==r)f=r=-1;else f++;}}
else if(c==3){if(f==-1)cout<<"Empty\n";else for(int i=f;i<=r;i++)cout<<q[i]<<" ";cout<<"\n";}
else cout<<"Invalid\n";
}
}
}
}Editor is loading...
Leave a Comment