I need to input numbers into an array, get the first number, mirror it, and then see if any other numbers in said array are the same as the mirror.
Example: 4 numbers, 123 321 111 and 200; the mirror of 123 is 321, so it should tell me "Yes", since there is 1 more element in the array that is the same as the mirror.
#include <iostream>
using namespace std;
int main()
{
int n = 0, mirror, cnt = 0;
int* v = new int[n];
cout << "How many elements?\n";
cin >> n;
for(int i=0; i<n; i++)
cin >> v[i];
while(v[0] != 0){
mirror = mirror * 10 + v[0] % 10;
v[0] /= 10;
}
cout << mirror;
for(int i=0; i<n; i++)
if(v[i] == mirror && v[i] != v[0])
cnt++;
if(cnt >=1)
cout << "Yes";
else
cout << "No";
return 0;
}