皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。 【说明】 设计一个日期类Date包括年、月、日等私有数据成员。要求实现日期的基本运算,如某日期加上天数、某日期减去天数、两日期相差的天数等。 在Date类中设计如下重载运算符函数: Date operator + (int days) : 返回某日期加上天数得到的日期。 Date operator - (int days) : 返回某日期减去天数得到的日期。 int operator - (Date&b): 返回两日期相差的天数。 【程序】 include<iostream.h> int day tab[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31}}; //day_tab二维数组存放各月天数,第一行对应非闰年,第二行对应闰年class Date { int year, month, day //年,月,日 int leap(int); //判断是否闰年 int dton(Date&) Date ntod(int) public: Date() { } Date (int y, int mint d) I year = y; month = m; day = d;} void setday(intd){day = d;} void setmonth(int m) {month = m;} void setyear(int y) {year =y;} int getday() {return day;} int getmonth() {return month:} int getyear() {return yea;} Date operator + (int days) //+运算符重载函数 { static Date date; int number =(1) date = ntod(number) return date } Date operator - (int days) //-运算符重载函数 { staffs Date date; int number=(2); number - = days; date = ntod(number) return date; } int operator - (Date &b) //-运算符重载函数 { int days=(3); return days; } void disp() { cout<<year<<'.'<<month<<'. '<<day<<endl; } }; int Date: :leap( int year) if((4)) //是闰年 return 1; //不是闰年 else return0: } int Date:: dton( Date &d) //求从公元0年0月0日到d日期的天数 { inty,m,days =0; for(y=1;y<=d. year;y++) if((5))days+ =366; //闰年时加366天 else days + = 365; //非闰年时加365天 for(m =0;m<d. month-1;m++) if((6)) days += day_tab[1] [m]; else days +=day_tab[0] [m]; days + = d. day; return days; } Date Date::ntod(intn) //将从元0年0月0日的天数转换成日期 { int y=1,m = 1,d,rest = n,lp; while(1) { if(leap(y)) if(rest<= 366) break; else rest - = 366; else //非闰年 if(rest = 365 ) break; else rest-=365;
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【简答题】热机是把______能转化成______能的机器,______是最常见的热机.
【单选题】Which of the following statements about labor unions can be concluded based on the information in the passage?
A.
Labor unions reached their peak of power in the 1986's.
B.
It took labor unions many years to improve conditions for workers.
C.
The early labor unions failed .because they were not concerned with the well-being of workers.
D.
The early labor unions failed because they could not agree on what they wanted to fight for.
【简答题】热机的分类:最早的热机是______;其次是______;______;______.
【单选题】下列关于热机的效率,说法正确的是 [     ]
A.
热机做的有用功越多,热机效率就越高
B.
热机的功率越大,热机的效率就越高
C.
消耗燃料少的热机,效率高
D.
以上说法都不对
【简答题】______是最早的热机.现代热机种类繁多,构造各异,有______、______、______、______.
【单选题】Focus groups are representatives of customers whose job is to provide you with information on their needs and preferences. {A、B、C}
A.
焦点小组是顾客的代表,他们的工作是把你的需求和喜好提供给顾客。
B.
焦点小组是顾客的代表,他们的工作是给顾客提供需求和喜好。
C.
焦点小组是顾客的代表,他们的工作是给你提供他们的需求和喜好。
【单选题】How can the users of terminals without processing capability acquire the necessary information?
A.
They can simply use a keyboard or a mouse.
B.
They should use a modem to maintain the host system.
C.
They should connect their computer to a satellite system.
D.
They can access its base through the programs on the system.
【单选题】中国石窟艺术的早期(北魏和北周时代)。其洞窟形式有方形、长方形,采用( )的开凿方式,也是这个时期的主要形制, 这种开凿形制在以后是不多见的。
A.
中心柱式
B.
殿堂式
C.
佛堂式
D.
中心柱塔庙式
【单选题】下列有关Bezier曲线性质的叙述语句中,错误的结论为
A.
Bezier曲线可用其特征折线集(多边形)来定义
B.
Bezier曲线必须通过其特征折线集(多边形)的各个顶点
C.
Bezier曲线两端处的切线方向必须与特征折线集(多边形)的相应两端线段走向一致
D.
n次Bezier曲线,在端点处的r阶导数,不只与r个相邻点有关
【单选题】关于热机的效率,下列说法中正确的是(   )
A.
热机做的有用功越多,热机效率一定高
B.
热机的功率大,热机效率一定高
C.
热机单位时间内消耗的燃料少,热机效率一定高
D.
以上说法都不对
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题