第三章节类和对象介绍.pptVIP

  • 1
  • 0
  • 约7.95千字
  • 约 44页
  • 2018-05-27 发布于江苏
  • 举报
#include iostream using namespace std; class Tdate { public: void set(int m,int d, int y) { month=m; day=d; year=y; } int Isleapyear() { return(year%4==0year%100!=0) ||(year%400==0); } void print() { coutmonth“/”day“/”yearendl; } private: int month; int day; int year; }; void main() { Tdate a; a.set(10,1,1949); a.print(); if(a.Isleapyear()) cout“It is a leap year!”; else cou

文档评论(0)

1亿VIP精品文档

相关文档