VERY long Syntax error

When compiling my source file on unix, im getting one VERRRRRRY long syntax error

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
27
28
#include<iostream>
#include <string>
using namespace std;
struct Date
{ 
    int month;
    int day;
    int year;
};

struct EmployeeInfo
{
int id;
string firstname;
string lastname;
Date birthday;
Date datehired;
double payrate;
int hours;
}; 
#include <iostream>
#include <iomanip>
#include <string>
#include "Employeeinfo.h"
using namespace std;
int main()
{
EmployeeInfo employee;
double grosspay, tax, netpay, totalgp=0, totaltax=0, count=0;
   cin  >>  employee.id  >> employee.firstname  >>  employee.lastname >> employee.birthday.month>>employee.birthday.day>>employee.birthday.year>>employee.datehired>>employee.payrate>>employee.hours;
while (count<10)
{
grosspay = employee.payrate * employee.hours;
if(grosspay>=1000)
tax = .25*grosspay;

else
{
	tax = .18*grosspay;
}
	netpay = grosspay - tax;
count++;
totalgp+= grosspay;
totaltax+= tax;
}
cout<<employee.id << employee.firstname << employee.lastname << employee.birthday.month <<employee.birthday.day<<employee.birthday.year<< employee.datehired << employee.payrate << employee.hours << tax << netpay << totalgp << totaltax<<endl;
return 0; 
}


error:
g++ lab2sourcefile.cpp
lab2sourcefile.cpp: In function `int main()':
lab2sourcefile.cpp:10: error: no match for 'operator>>' in '(+(+(+std::operator>> [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](((std::basic_istream<char, std::char_traits<char> >&)(+std::operator>> [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](((std::basic_istream<char, std::char_traits<char> >&)(+(&std::cin)->std::basic_istream<_CharT, _Traits>::operator>> [with _CharT = char, _Traits = std::char_traits<char>](((int&)((int*)(&employee)))))), ((std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)(((std::string*)(&employee)) + 4u))))), ((std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)(((std::string*)(&employee)) + ......................................................
Last edited on
cin >> employee.datehired and cout << employee.datehired won't work; class Date is not streamable.

Either overload the stream operators << and >> for Date

Or read/write each member separately:
cin >> employee.datehired.month >> employee.datehired.day >> employee.datehired.year
and like-wise for cout.
@JLBorges Thank you!!! Wow no one else pointed that out last night and I posted it like 3 times lmao.
Topic archived. No new replies allowed.