【发布时间】:2014-11-07 09:01:45
【问题描述】:
问题告诉我:
“该类应该有成员函数以下列格式打印日期”
- 3/15/13 //showShortDate
- 2013 年 3 月 13 日 //showLongDate
- 2013 年 3 月 15 日 //showEuroDate
函数实现文件中的以下内容将无法编译并给出"cout : undeclared identifier" 错误。我在主程序 .cpp 文件中有#include <iostream>。
// Date.cpp is the Date class function implementation file
#include "Date.h"
Date::Date(int m, int d, int y)
{ month = m;
day = d;
year = y;
}
Date::Date()
{
month = 1;
day = 1;
year = 2001;
}
void Date::showShortDate()
{
cout << month << "/" << day << "/" << year;
}
void Date::showLongDate()
{
cout << month << " " << day << ", " << year;
}
void Date::showEuroDate()
{
cout << day << " " << month << " " << year;
}
【问题讨论】:
-
啊,我已经关闭了这个问题,但是链接的东西是错误的。对不起。现在其他人需要对此进行近距离投票,因为它缺乏基础研究。
标签: c++