《软件测试技术及用例设计实训》源

2019-05-18 17:27

P168

源程序:

#include void main() { float A,B,X; scanf(“%f%f%f”,&A,&B,&X); if((A>1)&&(B==0)) X=X/A; if((A==2)||(X>1)) X=X+1; printf(“%f”,X); }

P171 源程序:

1. int testing(int x, int y) 2. {

3. int software=0; 4. if((x>0) && (y>0)) 5. {

6. software = x+y+10; 7. } 8. else 9. {

10. software = x+y-10; 11. } 12.

13. if(software < 0) 14. { 15. software = 0; 16. }

17. return software; 18. }

P173 源程序:

1 int Test(int i_count, int i_flag) 2 {

3 int i_temp = 1; 4 while (i_count>0) 5 {

6 if (0 == i_flag) 7 {

8 i_temp = i_count + 100; 9 break;

10 } 11 else 12 {

13 if (1 == i_flag) 14 {

15 i_temp = i_temp * 10; 16 } 17 else 18 {

19 i_temp = i_temp * 20; 20 } 21 }

22 i_count--; 23 }

24 return i_temp; 25 }

P174 源程序:

1 int _tmain(int argc, _TCHAR* argv[]) 2 { 3 int x,y; 4 scanf(\ 5 if(x > 0 && y > 0) 6 { 7 int i = 1; 8 if(x > y) 9 { 10 while((x * i)% y != 0) 11 i++; 12 printf(\13 } 14 else 15 { 16 while((y * i)% x != 0) 17 i++; 18 printf(\19 } 20 } 21 return 0; 22 }

P178 源程序:

int GetMaxDay( int year, int month ) {

int maxday = 0;

if ( month >= 1 && month <= 12 ) {

if ( month == 2 ) {

if ( year % 4 == 0 ) {

if ( year % 100 == 0 ) {

if ( year % 400 == 0 )

maxday = 29; else

maxday = 28; } else

maxday = 29;

} else

maxday = 28;

} else {

if ( month == 4 || month == 6 || month == 9 || month == 11 )

maxday = 30; else

maxday = 31;

} }

return maxday; }

P180

源程序:

Int IsLeap(int year) {

if (year % 4 == 0) {

if (year % 100 == 0) {

if ( year % 400 == 0) leap = 1;

}

else leap = 0; } else leap = 1; } else leap = 0; return leap;

P181 源程序: /*

作用:计算软件学院教师薪水

说明:节选自软件学院教师管理系统源代码 */

1 void CaculateTeacherSalary() 2 { 3 int i; 4 int j=0; 5 printf(\输入要计算的软件学院教师编号:\\n\6 fflush(stdin); 7 scanf(\8 for(i=0;i

16 printf(\输入月效益:\17 fflush(stdin); 18 scanf(\19 TeacherSalary[i]=(Teacher[i].TeacherBaseSalary+2*Teacher[i].TeacherMonthWorkDays+xiaoyi*Teacher[i].TeacherWorkYears/100)*0.5-baoxianjin;

20 printf(\号软件学院教师的薪水为:%lf元每月\\n\

21 break; //找到该教师后,直接跳出循环 22 } 23 } 24 if(j==0)

25 26 }

P182

printf(\未找到!\\n\

源程序: /*

作用:输出软件学院教师信息

说明:节选自软件学院教师管理系统源代码 */

1 void PrintTeacherInformation() 2 {

3 unsigned int i; 4 if(ActualNum!=0) 5 {

6 printf(\共有%d条软件学院教师信息\\n\7 printf(\8 for(i=0;i

\\n\

17 printf(\工龄:%d\\n\18 if(Teacher[i].TeacherSex==0) 19 printf(\性别:男\\n\20 else if(Teacher[i].TeacherSex==1)

21 22 23 24 25 26 27 28 29 30 31 32 33

printf(\性别:女\\n\else

printf(\性别:无\\n\ printf(\基本工资:%f\\n\ printf(\月工作天数:%d\\n\switch(Teacher[i].TeacherEducation) { case 1: printf(\教育背景: 高中\\n\ break; case 2: printf(\教育背景: 学士\\n\ break;


《软件测试技术及用例设计实训》源.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:北京首家Shopping Mall市场定位调查 - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: