c ++的一个简单问题

来源:百度知道 编辑:UC知道 时间:2024/05/31 20:02:57
谁能帮我看一下,这个程序为什么老出错

#include<iostream>
using namespace std;
void main()
{
struct Employee{
char name[2];
float salary;
char phone[11];
};
Employee employee1 ={"z",125.0,"6082462"};

cout<<employee1<<endl;

}

#include<iostream>
using namespace std;

struct Employee{
char name[2];
float salary;
char phone[11];
};

ostream& operator << (ostream& cout, Employee& e)
{
cout << e.name;
cout << e.salary;
cout << e.phone;
return cout;
}

void main()
{
Employee employee1 ={"z",125.0,"6082462"};
cout<<employee1<<endl;
}