问题 单项选择题

有如下程序: #include <iostream.h> #include <iomanip.h> using namespace std; class CSum { int x,y; public: CSum (int x0,int y0):x(x0),y(y0){} friend ostream & operator<<(ostream& os,const CSum& xa) {os<<setw(5)<<xa.x+xa.y;return os; } }; int main () { CSum y(3,5); cout<<setfill(’*’)<<8; cout<<y; return 0; } 执行上面程序的输出是

A.88

B.****88

C.****8****8

D.8****8

答案

参考答案:D

解析: 本题考核知识点包括:类与对象、运算重载、I/O的格式化输出。语句 "cout<<setfill(’*’)<<8;"输出8。语句"cout<<y;"将调用运算符重载输出****8,因为前面语句中设置的填充符号现在还有效,而数据"8"的宽度不够5,所以剩下4个字符的宽度用填充符号"*"填充。

阅读理解
阅读理解。
Children’s clubs
English club
Computer club
Time:  Monday, Thursday & Friday
       9:00 am-11:00 am
Room:  201
Teacher: Miss Liu
Tel:    023-8209643
       13698371652
Time:  Tuesday, Wednesday & Friday
       9:00 am-11:00 am
       3:00 pm-5:00 pm
Room:  503
Teacher: Mr. Hu
Tel:    023-68206162
       13708356472
Drawing club
Music club
Time:  Monday, Thursday & Sunday
       9:00 am-11:00 am
Room:  307
Teacher: Miss Yang
Tel:    023-68206569
       13783147258
Time:  Thursday, Saturday & Sunday
       9:00 am-11:00 am
       3:00 pm-5:00 pm
Place:  Music Classroom
Teacher: Miss Wang & Mr. Zhang
Tel:    023-68202280
       13057382119
1. Xiao Ming wants to learn computer, so he can call the number            .
A. 023-68206162 or 13783147258      
B. 023-68206162 or 13708356472
C. 023-68206569 or 13708356472      
D. 023-68202280 or 13057382119
2. You want to learn drawing, so you can go to             .
A. Room 201
B. the Music Classroom  
C. Room 503
D. Room 307
3. You are not busy on Thursday afternoon, so you can go to learn           .
A. English
B. drawing  
C. music
D. computer
4. What time are all the clubs open ?
A. 9:00 am-11:00 am.  
B. 3:00 pm-5:00 pm.
C. 9:00 am-6:00 pm.
D. 9:00 am-5:00 pm.
5. Which sentence is true?
A. Miss Wang and Mr. Zhang can teach you music.
B. Miss Liu and Mr. Hu can teach you drawing.
C. Miss Yang and Mr. Zhang can teach you English.
D. Miss Wang and Miss Liu don’t know music.
填空题