【发布时间】:2014-10-06 06:15:13
【问题描述】:
我有一个 c++ 项目,它有一个日期类,其中包含三个变量 int 日、月和年
class date{
int day;
int month;
int year;
public:
date(); // default constructor
date(int, int, int); // parameterized constructor with the three ints
date(string) // this constructor takes a date string "18/4/2014" and assigns
18 to intday, 4 to int month and 2014 to int year
};
我想知道如何拆分字符串日期并将子字符串分配给三个变量int day、month和year
【问题讨论】:
标签: c++