cfnr.net
相关文档
当前位置:首页 >> C++编程题定义一个时间类TimE,该类对象存放一个时间 >>

C++编程题定义一个时间类TimE,该类对象存放一个时间

定义的是时间类,不是日期类。我做了一些调整,看看能否满足你的需求。还有取时钟,分钟,秒钟我改成了返回时钟,分钟,秒钟值,这样合理一些。 class Time{ int Hour; int Minute; int Second; public: void GetTime()//取时间:格式为08:30:00 ...

#include#include#include "windows.h"class Date{private:int year;int month;int day;int IsCurrentDate(int Year,int Month,int Day);//是不是正确的日期。public:Date();Date(int y,int m,int d);Date(const Date &other);void GetDate();in...

#include#include#includeusing namespace std;class Time{public:Time() :h(0), m(0), s(0){}Time(int newh, int newm, int news) :h(newh), m(newm), s(news){}int geth(){ return h; }int getm(){ return m; }int gets(){ return s; }void se...

什么语言?

#include #include class datetime { public: int year; int month; int day; int hour; int min; int sec; datetime() { struct tm* ptm; time_t ltime; time(<ime); ptm = localtime(<ime); year = ptm->tm_year+1900; month = ptm->tm_mo...

#include #include using namespace std; int main() { SYSTEMTIME start; //windows.h中 GetLocalTime(&start);//time.h的tm结构体一样的效果 cout

#include using namespace std;class time{ int hour; int min; int sec;public: time(int h=0,int m=0,int s=0) { hour=h;min=m;sec=s; } ~time(){} friend time operator+(time t1,time t2); friend time operator-(time t1,time t2); void op...

class Date { public: Date() { year = 1900; month = 1; day = 1; } Date(int y, int m, int d); Date(Date &date); int GetYear ();//取年份 int GetMonth ();//取月份 int GetDay ();//取日子值 void SetDate (int year, int month, int day)...

#include "stdio.h"class Date{private: int year,month,day;public: Date(){year=0;month=0;day=0;}//默认构造函数 Date(int x,int y,int z){year=x;month=y;day=z;}//重载构造函数 void add(int m);//加天数 void del(int m);//减天数 int dif...

#include using namespace std;class Persion{public:Persion();Persion(char name[20], char sex[4], int age);void SetName(char name[20]);void SetSex(char sex[4]);void SetAge(int age);char *GetName();char *GetSex();int GetAge();void...

网站首页 | 网站地图
All rights reserved Powered by www.cfnr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com