#include<iostream>
#include<string>
#include<sstream>
#include<iomanip>
using namespace std;
class PalindromCH
{
private:
bool palindrom(const string& d)
{
for (unsigned g = 0; g < d.size() / 2; g++)
{
if (d[g] != d[d.size() - g - 1])
{
return 0;
}
}
return 1;
}
unsigned counter(stringstream& c, string& d)
{
unsigned number{ 0 }; cout << endl;
cout << "Entered sequence of numbers:" << endl;
while (c >> d)
{
cout << setw(7) << d;
if (palindrom(d))
{
number++;
}
}
return number;
}
void check_digit(string& i)
{
cin >> i;
try
{
stod(i);
}
catch (exception& u)
{
cerr << u.what() << endl;
}
}
public:
void examination()
{
unsigned f, t{ 0 }; stringstream v; string inp;
cout << "Enter the number of elements: ";
check_digit(inp);
f = stoi(inp);
while (f--)
{
inp.clear();
cout << "Enter ["<< ++t <<"]: ";
check_digit(inp);
v << inp << " ";
}
cout << endl << endl << counter(v, inp);
cout << " palindroms have been founded" << endl;
}
};
int main()
{
PalindromCH text;
text.examination();
return 0;
}
Ваш цикл был составлен некорректно.