Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void howMuchUnshift(int a[],int size,int Unshift)
- {
- cout<<"if you want unshift write any numbers else 0"<<endl;
- for(int i=0;i<5;i++)
- {
- cin>>Unshift;
- if(Unshift==0)
- {
- i=5;
- }
- if(a[i]==0)
- {
- a[i]=Unshift;
- }
- else
- {
- i=5;
- if(Unshift!=0)
- {
- cout<<"error in number "<<Unshift<<endl;
- }
- }
- }
- for(int i=0;i<5;i++)
- {
- cout<<a[i]<<" ";
- }
- cout<<endl;
- }
- void howShift(int a[],int size,int shift)
- {
- cout<<"if you want shift write number 1 else 0"<<endl;
- for(int i=0;i<5;i++)
- {
- cin>>shift;
- if(shift==0)
- {
- i=5;
- }
- if(a[i]!=0)
- {
- a[i]=0;
- }
- }
- for(int i=0;i<5;i++)
- {
- cout<<a[i]<<" ";
- }
- cout<<endl;
- }
- void howPop(int a[],int size,int pop)
- {
- cout<<"if you want pop write number 1 else 0"<<endl;
- for(int i=4;i>-1;i--)
- {
- cin>>pop;
- if(pop==0)
- {
- i=-1;
- }
- if(a[i]!=0)
- {
- a[i]=0;
- }
- }
- for(int i=0;i<5;i++)
- {
- cout<<a[i]<<" ";
- }
- cout<<endl;
- }
- void howPush(int a[],int size,int push)
- {
- cout<<"if you want push write any number else 0"<<endl;
- for(int i=4;i>-1;i--)
- {
- cin>>push;
- if(push==0)
- {
- i=0;
- }
- if(a[i]==0)
- {
- a[i]=push;
- }
- else
- {
- i=0;
- if(push!=0)
- {
- cout<<"error in number "<<push<<endl;
- }
- }
- }
- for(int i=0;i<5;i++)
- {
- cout<<a[i]<<" ";
- }
- cout<<endl;
- }
- void obnulit(int a[],int size)
- {
- for(int i=0;i<5;i++)
- {
- a[i]=0;
- }
- }
- int main()
- {
- int size=5;
- int a[size];
- int Unshift=0;
- int shift=0;
- int push=0;
- int pop=0;
- while(1==1)
- {
- obnulit(a,size);
- howMuchUnshift(a,size,Unshift);
- howShift(a,size,shift);
- howPop(a,size,pop);
- howPush(a,size,push);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement