Hi. This is for a phonebook assignment. Part of the assignment involves searching a 2D array. This is the function that reads the phonebook file.
void getData(char name[][NAMESIZE], char telephone[][PHONESIZE],
char zipcode[][ZIPSIZE], char address[][ADDSIZE], int& size);
~~~~~
void getData(char name[][NAMESIZE], char telephone[][PHONESIZE],
char zipcode[][ZIPSIZE], char address[][ADDSIZE], int& size){
int i = 0;
ifstream infile("phone_dir.txt");
while(!infile.eof()) {
infile.getline(name[i], NAMESIZE, '\t');
infile.getline(telephone[i], PHONESIZE, '\t');
infile.getline(address[i], ADDSIZE, '\t');
infile.getline(zipcode[i], ZIPSIZE, '\n');
i++;
}
}
I'm stuck in that no matter what I do I can't seem to find the match in the array?
Say I'm looking for the name Jack Daniel. I type in Jack and can't get a response. The only thing I tried was something like name == search I know this isn't how the search is to be done, that part I can figure out myself. It's just that no matter what I can't figure out how to get a positive from searching for "Jack" when the name array contains "Jack Daniel". At a complete loss, help would be appreciated.