so i have a couple of errors but my main question is using one data file to read into two different arrays. In my code i have a data file that is a list of baby names it is in the data file like this
1. noah sophia
2. liam emma
And so on it has 1000 entries and i need help getting the first name in a boy name array (mname) and the second in a girl name array (fnames) so in total the program is to let someone search a name in both array and output the locations that they are. Yes i know that the output isnt there yet but thats a quick cout if anyone can help would be very helpful!
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
void askName (string& name);
int search (string arr[], int 1001, string name);
int main () {
ifstream in_stream;
in_stream.open("babynames.txt");
string mnames[1001], fnames[1001];
int i, mloc, floc;
i=0;
while (in_stream >> i){
cin >> mname[i] >> fname[i];
}
}
askName (name);
mloc= search (mname[], 1001, name);
floc= search (fname[], 1001, name);