求高手帮忙改错下,急啊!!!(不明白错误什么意思)
#include<iostream>#include<string>
using namespace std;
class Date{
public:
Date();
Date(char *name,int x,char y,int m,int e,int c,int co);
void setdate(char *name,int x,char y,int m,int e,int c,int z);
void showstudent();
void aver(int Average,int m,int e,int c,int z);
private:
string Name;
int ID;
char Sex;
int Math;
int English;
int C;
int Computer;
int Average;
};
Date::setdate(char *name,int x,char y,int m,int e,int c,int z)
{
name=new char[10];
cin>>name>>x>>y>>m>>e>>c>>z;
delete []name;
}
Date::Date()
{}
void Date::showstudent()
{cout<<Name<<" "<<ID<<" "<<Sex<<" "<<Math<<" "<<English<<" "<<C<<" "<<Computer<<" "<<Average<<endl;}
void Date::aver(int Average,int m,int e,int c,int co)
{
Average=(m+e+c+co)/4;
}
Date::Date(char *name,int x,char y,int m,int e,int c,int z)
{
Name=name;
ID=x;
Sex=y;
Math=m;
English=e;
C=c;
Computer=z;
}
int main()
{
int q;
cout<<"Please Input the Number of Students:"<<endl;
cin>>q;
cout<<"Please input"<<" "<<q<<" "<<"student info: Name ID Sex Math English C Computer"<<endl;
Date *stu=new Date[q];
for(int j=0;j<q;j++)
{
stu[j].setdate();
}
cout<<endl<<"Student Information you input:"<<endl;
cout<<"Name ID Sex Math English C Computer Average"<<endl;
for(int i=0;i<q;i++)
{
stu[i].showstudent();
}
delete []stu;
return 0;
}
下面这是错误提示信息
D:\VC++\program work\program work\lab5\lab-5.cpp(23) : error C2556: 'int __thiscall Date::setdate(char *,int,char,int,int,int,int)' : overloaded function differs only by return type from 'void __thiscall Date::setdate(char *,int,char,int,int,int,int
)'
D:\VC++\program work\program work\lab5\lab-5.cpp(8) : see declaration of 'setdate'
D:\VC++\program work\program work\lab5\lab-5.cpp(23) : error C2371: 'setdate' : redefinition; different basic types
D:\VC++\program work\program work\lab5\lab-5.cpp(8) : see declaration of 'setdate'
D:\VC++\program work\program work\lab5\lab-5.cpp(57) : error C2660: 'setdate' : function does not take 0 parameters
Error executing cl..obj - 3 error(s), 0 warning(s)