Canis, on 02 August 2013 - 06:18 PM, said:

so i think im close, but heres the problem now; as mentioned earlier i was going to use strncmp to compare the first part of the string so .. the "twenty" of "twentyone" but i dont know, how i can compare the rest of it, so like the "one" part of it. What i did was something like this:

defined[10][10] = {"twenty","thirty"..."ninety"}; defined2[10][10] = {"one","two"..."nine"}; int finalnumber; for(int a=0;a<10;a++){ if(strncmp(input,defined[1],a){ //this is just pseudo, what i mean is that when finalnumber+=10; //it finds a match, it will add that much value to the final number im returning

so after i found a match for the first part.. how do i get to the second part of the number ?

Thanks!

wait ignore this.. i just realized how stupid that for loop is .. it will match even if its just one letter

sorry, will come up with another code, however, can you still answer the question above? that how will i compare whats after "twenty" in the "twentyone"

thanks