试题与答案

下列程序的输出结果是______。 #include<iostream.h> i

题型:填空题

题目:

下列程序的输出结果是______。
#include<iostream.h>
int CalcDigital(char*str)

if(str= =NULL)
return 0;
int num_of_digital=0;
for(int i=0;stri]!=0x0;i++)
if(str[i]<=’9’&& str[i]>=’0’)
num_of_digital++;
return num_of_digital;

void main( )

char a[]="Beijing20080lympic";
cout<<CalcDigital(a)<<endl;

答案:

参考答案:D

解析: 分析本题可知函数功能为计算一个字符串中包含的数字个数。字符串中包含的数字有2008,故输出为4。

试题推荐
题型:阅读理解

.

Teenagers at one German school are learning how to achieve happiness alongside other traditional subjects such as math and languages.

The class sit in a circle with their eyes shut and they count from one to ten: someone starts, the next voice comes from the far right, a third from the other side.

The aim of the game is to listen for an opportunity to shout out the number without clashing (冲突) with another voice or leaving a pause. On the first try, most of the young Germans try to be first, while a few are too shy to join in, but by the fifth time round, they develop a rhythm. The message: give other people space but also confidently claim your own. This is a requirement for social well-being.

The Willy Hellpach School in Heidelberg is the first in the nation to develop a happiness course. It is intended for students preparing for university entrance exams.

“The course isn’t there to make you happy,” Ernst Fritz-Schubert, the school principal, warned pupils, “but rather to help you discover the ways to become happy.”

Cooking a meal together is one of the class exercises. Improving body language under the guidance of two professional actresses is another.

The course is taught for three periods a week. Despite the happy subject, the pupils themselves insist it is no laughing matter.

“In the first period, we had to each say something positive about another member of the class and about ourselves. No laughing at people,” said Fanny, 17.

Research by the school shows it is not the first to start happiness classes: they also exist at some US universities, mainly based on positive thinking, using findings from studies of depression.

68. This passage is written to           .

A. introduce the happiness course in a German school

B. describe all the traditional courses in a German school

C. arouse the readers’ interest in happiness

D. help students struggle against being sad

69. According to the passage, the happiness course is__________.

A. created by the Willy Hellpach School

B. to make all the students happy all the time

C. required to be taken by the first year students

D. to help students discover the way to happiness

70. It can be inferred from the passage that__________.

A. the students’ self-respect can also improve happiness

B. the students just took the course as a laughing matter

C. the students can certainly become happy after the course

D. the students waste time learning something without value   

查看答案
题型:单项选择题 案例分析题

2013年4月3日,诺贝尔物理奖获得者丁肇中教授在日内瓦欧洲核子中心,首次公布其领导的阿尔法磁谱仪(AMS)项目18年之后的第一个实验结果——已发现的40万个正电子可能自一个共同之,即脉冲星或人们直寻找的暗物质。

丁肇中团队发现宇宙中“暗物质”存在新线索进一步佐证了()

①暗物质具有客观实在性、可知性

②人类可以有意识地改造自然

③新事物总是层出不穷的

④世界的本质是物质的

A.①②

B.③④

C.①④

D.②③

查看答案
微信公众账号搜索答案