Hello!
So , I got a weird problem.In my code the value of the char N[cn] is ignored when I compare it to a constant value.
Here's the code:
Code:
for ( i = 1; i <= 220; i++ ){
// Generate Numbers
itoa (i,Number, (V+1));
sscanf(Number, "%d", &ii);
stringstream ss;
ss << setw(NM) << setfill('0') << dec << ii;
string N = ss.str() ;
// DDDDDDDDDDDDD
for ( cn = 0; cn < (NM-1); cn++ ){
if ( ( N[cn] > 0 ) and ( N[cn+1] > 0 ) ){
if ((N[cn] < N[cn+1]) ){
C++;
}
}
}
// Stuff
// End
for ( cn = 0 ; cn <= (NM-1); cn++ ){
if ( N[cn] == 5 ){ ST++; }
}
if ( ST == NM ){ i = 220 ; cout << "Stopped \n";}
}
At the "// DDDDDDDDDDDDD" and "// End" parts where I have
if ( ( N[cn] > 0 ) and ( N[cn+1] > 0 ) ){
and
if ( N[cn] == 5 ){ ST++; }
the comparison is totally ignored.Why? How can I fix it?
Thanks!