C++,建立头文件问题,求大神指教如何在VC++6建立头文件,我的下面的错在哪里了?求改正?
#ifndefMY_CLASS#definestructDate{intyear;intmon;intday;voidSet(int,int,int);voidPrint...
#ifndef MY_CLASS#definestruct Date{ int year; int mon; int day; void Set(int,int,int); void Print();};class CDate{ int year; int mon; int day;public: void Set(int,int,int); void Print();};#endif
上面是头文件
下面是.cpp 文件
#include<iostream>#include"123.h"using namespace std;void CDate::Set(int y,int m,int d){ year=y; mon=m; day=d;}void CDate::Print(){ cout<<"year:"<<year<<" month "<<mon<<"day:"<<day<<endl;}void Date::Set(int y,int m,int d){ year=y; mon=m; day=d;}void Date::Print(){ cout<<"year:"<<year<<" month "<<mon<<"day:"<<day<<endl;} 展开
上面是头文件
下面是.cpp 文件
#include<iostream>#include"123.h"using namespace std;void CDate::Set(int y,int m,int d){ year=y; mon=m; day=d;}void CDate::Print(){ cout<<"year:"<<year<<" month "<<mon<<"day:"<<day<<endl;}void Date::Set(int y,int m,int d){ year=y; mon=m; day=d;}void Date::Print(){ cout<<"year:"<<year<<" month "<<mon<<"day:"<<day<<endl;} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询