谁能帮我改改,好多错误==
#include<iostream>using namespace std;
class date
{protected:
int year;
int month;
int day;
public:
date(inty,intm,int d)
{
year=y;
month=m;
day=d;
}
void display()
{
cout<<year<<"/"<<month<<"/"<<day<<endl;
}
};
class person
{protected:
string name;
public:
person(string n)
{
name=n;
}
void display()
{
cout<<name<<endl;
}
};
class student : public person
{protected:
date=birthday;
public:
student(date d,string n):person(n)
{
birthday=d;
}
void display()
{
cout<<name;
birthday.display();
}
};
int main()
{
int y,m,d;
cin>>y>>m>>d;
date d(y,m,d);
d.display();
person p("xiaoming",d):student s(d,"xiaoming");
s.display();
return 0;
}
//--------------------Configuration: ksd - Win32 Debug--------------------
Compiling...
dzwee.cpp
E:\\ksd\dzwee.cpp(32) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,structstd::char_traits<char>,class std::allocator<char>>' (or there is no acceptable conversion)
E:\\ksd\dzwee.cpp(38) : error C2059: syntax error : '='
E:\\ksd\dzwee.cpp(38) : error C2238: unexpected token(s) preceding ';'
E:\\ksd\dzwee.cpp(55) : error C2371: 'd' : redefinition; different basic types
E:\\ksd\dzwee.cpp(53) : see declaration of 'd'
E:\\ksd\dzwee.cpp(56) : error C2228: left of '.display' must have class/struct/union type
E:\\ksd\dzwee.cpp(57) : error C2143: syntax error : missing ';' before ':'
E:\\ksd\dzwee.cpp(58) : error C2065: 's' : undeclared identifier
E:\\ksd\dzwee.cpp(58) : error C2228: left of '.display' must have class/struct/union type
执行 cl.exe 时出错.
dzwee.obj - 1 error(s), 0 warning(s)