Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- void is_sortedA(int size,int arr[]);
- void is_sortedB(int size,int arr[]);
- bool f,g;
- void is_sortedA(int size,int arr[])
- {
- if(size<=1)
- return ;
- else
- {
- if(arr[size-1]>arr[size-2])
- is_sortedA(size-1,arr);
- else{
- f=false;
- return ;
- }
- }
- }
- void is_sortedB(int size,int arr[])
- {
- if(size<=1)
- return ;
- else
- {
- if(arr[size-1]<arr[size-2])
- is_sortedB(size-1,arr);
- else{
- g=false;
- return;
- }
- }
- }
- int main()
- {
- int n,i,arr[100],p;
- queue<string>q;
- cin>>n;
- while(n--)
- {
- for(i=0; i<10; i++)
- {
- cin>>arr[i];
- }
- f=true;
- g=true;
- is_sortedA(10,arr);
- is_sortedB(10,arr);
- if(f==true || g==true)
- q.push("Ordered");
- else
- q.push("Unordered");
- }
- cout<<"Lumberjacks:"<<endl;
- p=q.size();
- while(p--)
- {
- cout<<q.front()<<endl;
- q.pop();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement