A ovde kad izbrisem nulu on nece da radi kako treba a sa nulom radi.
A ta nula je u biti ovo broj 2 + 48('0') = 50 sto je u charu broj 2 ili????
ubaci broj 123456 i onda ubaci 2 i treba da ti ispise 1.
Code:
#include <iostream>
using namespace std;
bool intTest(int n, char c)
{
if(n == 0)
return false;
char t = n % 10 + '0';
if(t == c)
return true;
return intTest(n / 10, c);
}
int main()
{
int z;
int n;
char c;
do {
cout << "int n, char c: ";
cin >> n >> c;
cout << intTest(n, c) << endl;
cout << endl;
cout << "Jos jednom? (0=Prekini) ";
cin >> z;
} while(z != '0');
return 0;
}