题目内容

Section One Directions: In this section, you will hear ten short statements. Each statement will be spoken only once. After each statement, there will be a pause. During the pause, you must read the four suggested answers marked A, B, C and D, and decide which is the best answer.

A. They usually hold savings accounts.
B. They have current accounts.
C. They specialize in long-term savings accounts and mortgages.
D. They deal in short-term savings accounts.

查看答案
更多问题

有以下程序,若运行时从键盘输入:18,11,则程序的输出结果是【 】。 main() {int a,b; printf("Enter a,b:");scanf("%d,%d",&a,&b); while(a!=b) { while(a>b)a-=b; while(b>a)b-=a; } printf("%3d%3d\n",a,b); }

Passage Two

A. Three items.
B. $10.8.
C. A blue one.
D. U.S. Dollars.

[说明] 设计一个日期类Date,包括年、月、日等私有数据成员。要求实现日期的基本运算,如某日期加上天数、某日期减去天数、两日期相差的天数等。 在Date类中设计如下重载运算符函数。 Date operator+(int days):返回某日期加上天数得到的日期。 Date operator-(int days):返回某日期减去天数得到的日期。 int operator-(Date &b):返回两日期相差的天数。 [C++程序] #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)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 year; Date operator+(int days) //+运算符重载函数 static Date date; int number= (1) ; date=ntod (number); return date; Date operator-(int days) //-运算符重载函数 statis 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 return 0; int Date::dton (Date &d) //求从公元0年0月0日到d日期的天数 int y,m,days=0; for (y=1;y<=d.year;y++) if( (5) )days+=366; //闰年时加366天 else days+=365; //非闰年时加365天 for (m=0;m<d.mont.h-1;m++) if (leap (d.year) days+=day_tab [1] [m]; else days+=day__tab [0][m]; days+=d.day; return days; Date Date::ntod (int n) //将从公元0年0月0日的天数转换成日期 int y=1,m=1,d,rest=n,1p; while (1) if (leap (y)) if (rest<-366)break; else rest-=366; else //非闰年 if (rest=365)break; else rest-=365; y++; y--; 1p=leap (y); while (1) if (1p) //闰年 if (rest>day_tab [1][m-1])rest-=day_tab [1] [m-1]; else break; else //非闰年 if(rest>day_tab[0] [m-1])rest-=day_tab[0][m-1]; else break; m++: d=rest; return Date (y; m, d); void main() Date now(2003, 10,1),then (2005,6,5); cout<<"now:"; now. disp(); cout<<"then:"; then .disp(); cout<<"相差天数:"<<(then-now)<<endl; Date d1=now+1000,d2=now-1000; cout<<"now+1000:"; d1. disp(); cout<<"now-1000:"; d2. disp();

[说明] 函数void convert(char *a,int n)是用递归方法将一个正整数n按逆序存放到一个字符数组a中,例如n=123,在a中的存放为’3’、’2’、’1’。 [函数2.1] void convert(char *a,int n) int i; if((i=n/10)! =0) convert( (1) ,i); *a= (2) ; [函数2.2说明] 函数int index(char *s,char *t)检查字符串s中是否包含字符串t,若包含,则返回t在s中的开始位置(下标值),否则返回-1。 [函数2.2] int index(char *s, char *t) int i,j=0;k=0; for(i=0; s[i]!=’\0’;i++) for ( (3) ;(t[k]!=’\0’)&&(s[j]!=’\0’) &&( (4) );j++,k++); if( (5) ) return (i); return (-1);

答案查题题库