问题 单项选择题

以下模板定义:
template<class T>
T fun(T x,T y)return x*x+y*y;
下面对fun的调用中错误的是( )。

A.fun<int>(2,6.5)

B.fun(2,6.5)

C.fun<>(2,6)

D.fun(2,6)

答案

参考答案:B

解析: C++中声明函数模板的格式是:template<模板形参表声明><函数声明>,模板函数的调用可以省略实参模板,但实参模板的省略是有条件的。如果从模板函数实际参数列表中获得的信息有矛盾,则不能省略实际参数模板。

阅读理解

Everyone hopes to have a healthy lifestyle. But do you know what a healthy lifestyle is like? Here are some ways that lead to(导致) a healthy lifestyle.

Get active(积极的)

This is the most important way of a healthy lifestyle. Walking, running and playing basketball and other sports will help you keep healthy.

If your job needs long hours of sitting, get up often and walk. Don’t let laziness(懒惰) stop your body and mind. Be active at your workplace, around your neighborhood(邻近地区) and wherever(无论那里) possible.

Keep clean

Keep the places around you clean. Cleanliness(清洁)can create(创造) a healthy lifestyle. Unclean(不干净 ) and untidy(不整齐) places can not only make you angry but also make you ill.

Eat healthily

Our health depends on(依赖于)our food, so everyone should remember to eat healthy food. The healthier food you eat, the healthier you will be.

Live green

This is the easiest way to live a healthy lifestyle. Plant trees around your house. Try your best to save water. Stop using things that are bad for the environment.

小题1:Which is the most important way to have a healthy lifestyle?

A.Living green.

B.Keeping clean.

C.Eating healthy.

D.Getting active.小题2:How many ways does the passage tell the people to have a healthy lifestyle?

A.Two.

B.Three.

C.Four.

D.Five.小题3:Which is the easiest way to live a healthy lifestyle?

A.Getting active.

B.Living green.

C.Keeping clean.

D.Eating healthy.小题4:What does the underlined word “environment” mean in Chinese?

A.空气

B.矿藏

C.环境

D.垃圾小题5:How will unclean places make people feel?

A.Excited.

B.Sad.

C.Happy and healthy.

D.Angry and ill.

选择题