Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,n,m;
- cout<<"Enter how many test case you want"<<endl;
- cin>>t;
- for(int i=1;i<=t;i++)
- {
- cout<<"Test case : "<<i<<endl;
- cout<<"How many data you want to enter in queue"<<endl;
- cin>>n;
- int a[n];
- for(int j=0;j<n;j++)
- {
- cin>>a[j];
- }
- cout<<"M = ";
- cin>>m;
- cout<<endl;
- if(m<n)
- {
- for(int j=0;j<m;j++)
- {
- cout<<a[j]<<" ";
- }
- cout<<endl<<"In Queue : ";
- for(int j=m;j<n;j++)
- {
- cout<<a[j]<<" ";
- }
- cout<<endl;
- }
- if(m>=n)
- {
- for(int j=0;j<n;j++)
- {
- cout<<a[j]<<" ";
- }
- cout<<endl<<"In Queue : Empty"<<endl;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment