Guest User

Untitled

a guest
Jul 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #define SIZE 9
  4. namespace My
  5. {
  6. bool foo(int *a, bool b)
  7. {
  8. for(int i=0;i<(SIZE-2);i++)//дерево, але підійде
  9. {
  10.    if( (arr[i]==1)&&(arr[i+1]==2)&&(arr[i+2]==3) )
  11.  {
  12.    return true;
  13.  }
  14. }
  15. return false;//просто написав, щоб було
  16. }
  17. }
  18.  
  19. int main()
  20. {
  21.   int arr[SIZE]={1,2,3,4,5,6,7,8,9};
  22.   int brr[SIZE];
  23. for (int i=0;i<SIZE;i++)
  24.   brr[i]=SIZE-i;//для прикладу заповнення масива
  25.  
  26. cout<<My::foo(arr,1)<<endl<<My::foo(brr,1)<<endl;
  27. }
Add Comment
Please, Sign In to add comment