c++ Date 类
来源:百度知道 编辑:UC知道 时间:2024/06/14 03:57:31
//====================================
//满足Date 的类
//====================================
#include<iostream>
using namespace std;
//--------------------------------------
class Date{
int year,month,day;
public:
Date() {year=2009;month=1;day=1;}
void change();
void print();
void set(int y,int m,int d);
};
void Date::change()
{
if((year%4==0&&year%100!=0)||(year%400==0))
{
if(month==2)
if(day=28)
{
day=29;
}
}
else
{
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10: {
if(day==31)
{
month++;
day=1;
}
else day++;
break;
}
case 4:
case 6:
case 9:{
if(day==30)
{
month++;
day=1;
}<
//满足Date 的类
//====================================
#include<iostream>
using namespace std;
//--------------------------------------
class Date{
int year,month,day;
public:
Date() {year=2009;month=1;day=1;}
void change();
void print();
void set(int y,int m,int d);
};
void Date::change()
{
if((year%4==0&&year%100!=0)||(year%400==0))
{
if(month==2)
if(day=28)
{
day=29;
}
}
else
{
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10: {
if(day==31)
{
month++;
day=1;
}
else day++;
break;
}
case 4:
case 6:
case 9:{
if(day==30)
{
month++;
day=1;
}<
void Date::print()
{
cout<<day<<"\"<<month<<"\"<<year<<endl;
}
这段代码有错,
void Date::print()
{
cout<<day<<"\\"<<month<<"\\"<<year<<endl;
}
就行了,
前者“\“会有错,因为\+符号会有特别意思的,比如\n表示回车。
应该写成"\\"就行了
我的电脑中木马了,在c:\windows\system32\date.dll
L/C 90 DAYS FROM THE B/L DATE / D/P是什么意思????
打开IE,咔吧斯基跳出可疑操作date execution,c:\...\internet explorer\iexplore.exe
为什么那么多人那么无聊玩RPG和3C以及DATE那些
请问怎么写一个函数c语言的函数,char * date(char dat[8],int p)
信用证的31D:Date and place of expiry与44C:Lastest date of shipment 有什么区别?请高手指教!
各位C++高手们帮个小忙....如何定义一个日期类date
Census Date
expedition date
Date是什么意思?