Not reading or allowing operations

I have two errors I don't understand.

The first is cin will not read the struct member being passed to it. The second is the compiler will not allow me to multiply to of the structure members.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "stdafx.h"
#include "h.h"
#include <iostream>
#include <cstring>
#include <string>
#include <iomanip>
#include <fstream>
#include <cstdlib>

const int size = 50;

struct EmpData
{
	char empNameDatf[size];
	char empNameDatl[size];
	char empStat[size];
	int empIdDat[size];
	double empHrsWrk[size];
	double empPayDat[size];
	double totalPay[size];
};

EmpData empArray[10];


1
2
3
4
  case 3: empHrs(&empArray[index], size, count, outFile);
			 index++;
			 count++;
			 break;

1
2
3
4
5
6
7
8
9
10
11
12
void empHrs(struct EmpData *s, int size, int count, ofstream &outFile)
{
	cout << "Please enter employee # " << count + 1 << "'s Hours: \n";
	cin.ignore();
	cin >> s->empHrsWrk;

	cout << '\n';

	outFile.open("empData.txt", ios::app);
	outFile << s->empHrsWrk << '\n';
    outFile.close();
}


I get this error:

error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)

Next:

1
2
3
4
totPay(&empArray[index], size, count, outFile);
			 index++;
			 count++;
			 break;

1
2
3
4
5
6
7
8
9
10
void totPay(struct EmpData *s, int size, int count, ofstream &outFile)
{
	s->totalPay = s->empHrsWrk * s->empPayDat;

	cout << '\n';

	outFile.open("empData.txt", ios::app);
	outFile << s->totalPay << '\n';
    outFile.close();
}


I get this error:

error C2296: '*' : illegal, left operand has type 'double [50]'
error C2297: '*' : illegal, right operand has type 'double [50]'


Topic archived. No new replies allowed.