Salut ! Uita-te peste programul de mai jos, si spune-mi daca ai vreo nelamurire.
Eu mi-am dat niste teste pe care, din fericire, a mers.
#include <fstream>
using namespace std;
ifstream fin("date.in");
ofstream fout("date.out");
int x, xinvers, n, i, total, aux;
int main() {
fin >> n;
for(i = 1;i <= n;i++) {
fin >> x;
fout << x << ' ';
}
fout << 'n';
fin.close();
ifstream fin("date.in");
fin >> n;
for(i = 1;i <= n;i++) {
fin >> x;
aux = x;
xinvers = 0;
while(aux != 0) {
xinvers = xinvers * 10 + aux % 10;
aux /= 10;
}
if(x == xinvers) {
fout << x << ' ';
total++;
}
}
if(total > 0) fout << 'n';
if(total > 0) {
fout << "S-au gasit: " << total << " numere palindroamen";
}
else {
fout << "Nu s-a gasit niciun numar palindrom!n";
}
fin.close();
fout.close();
return 0;
}