Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #define n 10
- using namespace std;
- bool FindPolyndrom(int index1, int index2, int *m)
- {
- bool polyndrom;
- for(int j=index1; j<index2/2; j++)
- {
- polyndrom = true;
- if (m[j]!=m[index2-j-1])
- {
- polyndrom = false;
- break;
- }
- }
- return polyndrom;
- }
- void main( void )
- {
- int mas[n];
- cout<<"Input elements of massive->"<<endl;
- int i=0;
- while (i!=n)
- {
- cin>>mas[i];
- i++;
- }
- cout<<endl<<"Massive -> ";
- for (int j=0; j<n; j++)
- cout<<mas[j]<<" ";
- cout<<endl;
- if (FindPolyndrom(0,n,mas))
- cout<<endl<<"Find polydrom";
- getch();
- }
Add Comment
Please, Sign In to add comment