64,635
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
struct abc
{
int a;
std::string b;
double c;
friend ostream& operator << (ostream &out,abc &hot)
{
out << hot.a << hot.b << hot.c;
return out;
}
}
int main()
{
abc a;
a.a=3;
a.b="none";
a.c=3.204;
std::cout <<a<<endl;
}
//帮你改好了GCC上编译通过
#include <iostream>
using namespace std;//引用空间名就不用后面的,std::cout
struct abc
{
int a;
std::string b;
double c;
friend std::ostream& operator << (std::ostream &out,abc &hot)
{
out << hot.a << hot.b << hot.c;
return out;
}
};//这点问题
int main()
{
abc a;
a.a=3;
a.b="none";
a.c=3.204;
cout <<a<<endl;
system("pause");
return 0;
}