Searching a string inside a char array using Divide and Conquer

Let’s say that i have a struct array and each element has a name. Like:

struct something{
  char name[200];
}a[NMAX];

Given a new string (char array), i need to find the correct index for it using divide and conquer. Like:

char choice[200];
cin>>chioce;
int k=myFunction(choice);  // will return the index, 0 otherwise
                           // of course, could be more parameters
if( k )  
 cout<<k;

I don’t know how to create that searching function (i tried, i know how D&C works but i’m still learning! ), maybe you guys can help me. Thanks !


Source: c++

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.