Guest User

Untitled

a guest
May 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #define n 10
  4. using namespace std;
  5.  
  6. bool FindPolyndrom(int index1, int index2, int *m)
  7. {
  8.     bool polyndrom;
  9.     for(int j=index1; j<index2/2; j++)
  10.     {
  11.         polyndrom = true;
  12.         if (m[j]!=m[index2-j-1])
  13.         {
  14.             polyndrom = false;
  15.             break;
  16.         }
  17.     }
  18.     return polyndrom;
  19. }
  20.  
  21. void main( void )
  22. {
  23.     int mas[n];
  24.     cout<<"Input elements of massive->"<<endl;
  25.     int i=0;
  26.     while (i!=n)
  27.     {
  28.         cin>>mas[i];
  29.         i++;
  30.     }
  31.     cout<<endl<<"Massive -> ";
  32.     for (int j=0; j<n; j++)
  33.         cout<<mas[j]<<" ";
  34.     cout<<endl;
  35.     if (FindPolyndrom(0,n,mas))
  36.         cout<<endl<<"Find polydrom";
  37.     getch();
  38. }
Add Comment
Please, Sign In to add comment