hi I have this line in a file
AxBrCrAx....... //like this
I want to know how can I find out how many times A occured with x and also how man times r occurred? any simple solution?
thanks
your char positions in your string are like (0, 1, 2, 3, 4, 5, 6, 7)
in order to find what you are searching for you need to take every adjacent pair of positions and compare them ... for example
>start by taking (0, 1) which is A and x , compare them if they are A and x then increment occurences by one
>then you will take (1, 2) which is x B , compare them they are not A x so next
>(2, 3) compare them
>(3, 4) ...
then you make a second iteration throug your string and find all r's
Create a vector of type char..store the file..and traverse through it to find the occurrence