nextday 软件测试.doc_第1页
nextday 软件测试.doc_第2页
nextday 软件测试.doc_第3页
nextday 软件测试.doc_第4页
nextday 软件测试.doc_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

精品文档吉林大学应用技术学院实验(训)报告单(电子版)实验编号2实验班级实验名称测试nextdate任务书编号1实验组别实验组成员报告人指导教师实 验 报 告代码: #ifndef _Date_H #define _Date_H #include class Date public: Date() Date(int,int,int); Date(Date &); Date() void setDate(int,int,int); bool IsLeapYear() const; int TimeElapsed() const; void NextDate(); void print(); private: int year; int month; int day; ; #endif #include #include stdlib.h Date:Date(int y,int m,int d) year=y; month=m; day=d; Date:Date(Date &a) year=a.year; month=a.month; day=a.day; void Date:setDate(int y,int m,int d) year=y; month=m; day=d; int tof; if(year1919&year0&month0&day0&day0&day0&day29) tof=1; break; else tof=0; break; default: tof=0; break; else tof=0; if(tof=0) cout请输入正确的年月日1900&year0&month13) switch(month) case 1: case 3: case 5: case 7: case 8: case 10: if(day=31) month+=1; day=1; break; else day+=1; break; case 4: case 6: case 9: case 11: if(day=30) month+=1; day=1; break; else day+=1; break; case 12: if(day=31) year+=1; month=1; day=1; break; else day+=1; break; case 2: if(IsLeapYear()&day=29)|(!IsLeapYear()&day=28) month+=1; day=1; break; else day+=1; break; default: cout无效输入!!endl; void Date:print() cout日期为: year年 month月 day日; #include int y,m,d;int inputYear() int y; couty; if(y1900&y2050)return y; else cout无效输入!endl;return y; int inputMonth() coutm; if(m0&m13)return m; else cout无效输入!endl;return m; int inputDay() coutd; if(d0&d32)return d; else cout无效输入!endl; return d; void main() While(1) Date NowDate; cout请输入endl;int Y=inputYear(); int M=inputMonth(); int D=inputDay(); NowDate.setDate(Y,M,D); NowDate.print(); NowDate.TimeElapsed(); NowDate.NextDate(); cout下一天的; NowDate.print(); coutendl; Nextdate测试用例:输入条件有效等价类无效等价类日期范围11日期272日期=283日期=294日期=305日期=316日期318日期=299日期=3010 日期=3111 非数字字符月份范围12月份=4,6,9,1113月份=1,3,5,7,8,1014月份=215月份=1216月份1218非数字字符年范围191900=年=2050的闰年201900=年=2050的非闰年21年205023 非数字字符Nextdate测试用例:序号日期月份年预期结果1000 无效输入!2051999 无效输入!32501999 无效输入!42550 无效输入!53251999 无效输入!625 131999 无效输入!72551890 无效输入!82552051 无效输入!928122000 2000 12 29102821999 1999 3 11128121999 1999 12 29122822000 1999 2 29132921999 无效输入!142922000 2000 3 11529121999 1999 12 301629122000 2000 12 30173051999 1999 5 31183061999 1999 7 1193052000 2000 5 302030 62000 2000 7 1213151999 1999 6 1223161999 无效输入!233152000 2000 6 1243162000 无效输入!2525121999 1999 12 262629121999 1999 12 302730121999 1999 12 31283112 1999 2000 1 12929122000 2000 12 303030 122000 2000 12 313131122000 2001 1 1322551999 1999 5 26332561999 1999 6 26342552000 2000 5 26352562000 2000 6 2636111900 1900 1 23731121900 1901 12051 1 1 39112050 2050 1 240L51999 无效输入!4125L1999 无效输入!42255L 无效输入!43-25 51999 无效输入!4425-51999 无效输入!45255-1999 无效输入!46301120502050 12 147301119991999 12 1

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论