i have created a test string called strngs.Code:int main() { char strngs[100][20]={"BILL","BILL","BILL","JACK","JACK","KEN"}; checkDouble(strngs,6); } void checkDouble(char array[100][20], int len) { int i=0; static int cnt = 0; if(strcmp(array[i],array[++i])) { ++cnt; cout<<"There are "<<cnt << " "<<array[i]; checkDouble(array,--len) } else cnt = 0; }
strngs have 6 index.
i want to pass it to checkDouble so it will print something like this
There are 3 BILL
There are 2 JACK
There are 1 KEN
i know my recursion checkDouble is not correct and i dont know how to code this function.
can i get some help.
thanks.



LinkBack URL
About LinkBacks



