Sorry if this is a noob mistake, I'm really new to C++. My cin
is not taking the value I'm trying to pass it.
void getData(incomeInfo incomeInfo, const int NUM_EMPS) {
for (int i = 0; i < NUM_EMPS; i++) {
cout << "Employee #" << i + 1 << "'s name: " << endl;
cin >> incomeInfo[i].name;
cout << endl;
cin.ignore();
}
The incomeInfo structure:
struct incomeInfo {
string name;
double pay;
double healthInsuranceDeduction;
};
And the call:
incomeInfo employees[NUM_EMPS];
The error message I get is No operator [] matches these operands; operands types are incomeInfo[int]
. I'm passing it an int
. Thanks!