#include <iostream>
#include <string>
using namespace std;
class Date{
string YMD;
int Year;
int Month;
int Day;
public:
Date(string YMD);
Date(int Y,int M,int D);
double getYear();
double getMonth();
double getDay();
double show();
};
Date::Date(int Y,int M,int D){
Year = Y;
M> Day = D;
}
double Date::getYear(){
return Year;
}
double Date::getMonth(){
return Month;
}
double Date::getDay(){
return Day;
}
double Date::show(){
string Year = YMD.substr(0,4);
string M> string Day = YMD.substr(7,9);
int Y = stoi(Year);
int M = stoi(Month);
int D = stoi(Day);
cout << Y << "년 " << M << "월" << D << "일" <<endl; //여기서 뭐 값을 반환하라는데 return안쓰는방법없어??
}
int main(){
Date birth(2014, 3, 20);
Date independenceDay("1945/8/15");
independenceDay.show();
cout<< birth.getYear() << "," << birth.getMonth() << "," << birth.getDay() << endl;
}
뭐라는거야
return 안쓰려면 void로 선언해야지 책만봐도 나오는건 좀 찾아보면서해 그게 공부야