How would you put a counter into an If statement to check if there is a specific amount of chars, Say 'x' or 'y'?

Thanks

How would you put a counter into an If statement to check if there is a specific amount of chars, Say 'x' or 'y'?

Thanks

Too vague. Specific number of chars in what? Some string? What are x and y?

VernonDozier is right, but if I understand you correctly, putting a counter into an if statement wouldn't be of any help.

The if statement would go in, increment/decrement, and then go out. You'd need a loop either in or outside of the loop the if statement as well if you want to count, say the number of 'x' in the line "xxxxxxxxxxxxxxxxxxxxxx". Of course, you'd have to parse that line into the individual chars first, but that doesn't matter at the moment. The code would still be something like...

// parse string into characters
while ( /* not through all characters*/ )
        { if ( /* is this an x? */ )
              { xcount++; }
         }

Hope this helps.