Please Help with this array

I am trying to run a search function of an array like this

4
Brianna
Lindsey
Lisa
Paul
and be able to search Li and find Lisa and Lindsey but my code isn't outputting anything and I don't know what to do

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  void search(ifstream& infile){
int number;
infile>>number;
string firstname1[number],lastname2[number],birthdate3[number];

for(int i=0; i<number; i++){
    infile>>firstname1[i]>>lastname2[i]>>birthdate3[i];

}
string itemToFind;
cout<<"Name?"<<endl;
cin>> itemToFind;
for(int i = 0; i < number; i++){

        string firstname;
        int position;
        firstname1[i]=firstname;
        position=firstname.find(itemToFind);
        if (position>=0){
        cout<<firstname[i];
        }


     }
}
Topic archived. No new replies allowed.