The program is to identify the number of alphabet(capital & small), digits(0 to 9) that appears in a string.
I know the source code for it(strlen,switch case, i etc). However, using switch case is a lot of work. Is there an easier way to do it?
Thanks!
The program goes like this:
<Input>
Enter a string : KaccBBZe1344*9)(k
<Output>
a =1, b =0, c =2, d =0, e =1, f=0.....k=1.........z=0
A =0, B =2, C =0...K =1.....Z =1
0 =0, 1 =1, 2 =0, 3=1, 4 =2....9 =0
Others = 3 // *)(
By casting char to int, comparison is unavoidable (if else...). Is there a function that identify the string?
Appreciate if anyone can help. Thank you.
Tags: