Operator>> no match

I have a code that reads two names into two different arrays, and it is saying that the operator>> has no match
Here is the important part of the code:
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
26
#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
using namespace std;

int main()
{
  int order, i=0;
  string name;
  const string male[2000], female[2000];
  ifstream infile;
  infile.open("babynames.txt");
  if(!infile)
     cout << "Error opening input\n";
  else
  {
    while(infile >> order)
    {
       infile >> male[i] >> female[i];
       i++;
    }
  }
  infile.close();
}
Last edited on
You have marked your arrays as 'const' -- meaning they shouldn't be modified. Remove the const and try again.

Hope this helps.
Thanks! That did it.
Topic archived. No new replies allowed.