trouble displaying array of structs

here is the code for my header file. when I run the program I get this error message:
Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'consultCo::employee' (or there is no acceptable conversion)
Im also not sure if my newemployee function is doing what I would like it to.
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
29
30
31
32
  #include<iostream>
#include<string>
using namespace std; 

class consultCo
{
public:
	void newemployee();
	void display();
	void raise();
private:
	struct employee
	{
	string name;
	int rate;
	int social;
	};
	employee info[2];
};
void consultCo::newemployee()
{
employee joe;
joe.name = "Joe";
joe.rate = 15;
joe.social = 123456789;
info[0] = joe;
}
void consultCo::display()
{
for(int i=0; i<2; i++)
std::cout << info[i] << endl;
}
Well, when you create two employees (info 0 and info 1) you never define what you mean when you use any sort of display command. What you need to do is create a function that displays the values of name, rate, and social. Otherwise, your code isn't aware of how to display the contents of the structure- it has to be told how.
ok so I tried that and I am getting error messages.
here is my new code for displaying
1
2
3
4
5
6
7
void consultCo::displayscreen()
{
for(int i=0; i<2; i++)
{
cout << employee.name << "   " << employee.rate <<"   "<< employee.social << endl;
}
}

Topic archived. No new replies allowed.