1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
char numbPol[1024];
int flag=0;
do{
if(flag){
system("cls");
cout<<"Error. Try again!"<<endl;
}
cout<<"Input number n<9999, consist of 4 signs: ";
cin>>numbPol;
flag=0;
for(int i=0;i<4;i++){
if(numbPol[i]<48||numbPol[i]>58||strlen(numbPol)!=4) flag=1;
}
}while(flag);
for(int i=0,j=3;i<4;i++,j--){
if(numbPol[i]==numbPol[j]) flag=1;
else{
flag=0;
break;
}
}
if(flag) cout<<"Number "<<numbPol<<" is polindrom"<<endl;
else{
cout<<"Number "<<numbPol<<" isn't polindrom"<<endl;
for(int i=0;i<4;i++){
flag=1;
for(int j=i+1;j<4;j++)
if(numbPol[i]==numbPol[j]) flag++;
if(flag==3){
cout<<"Number "<<numbPol<<" have 3 similar figures"<<endl;
break;
}
}
}
getch();
return 0;
}