问题 填空题

以下程序的运行结果是 【19】 。 #include<string.h> typeaef struct student{ char name[10]; long sno; float score; {STU; main() { STUa={"zhangsan",2001,95},b={"Shangxian",2002,90},c={"Anhua",2003,95},d,*p=&d; d=a; if(strcmp(a.name,b.name)>0)d=b; if(strcmp(C.name,d. name)>0)d=C; printf("%1d%s\n",d.sno,p->name); }

答案

参考答案:2002Shanxian

解析:本题中第一个if语句将结构体变量a.name和结构体变量b.name中较小的那个赋值给结构体变量d,第二个if语句将结构体变量c.name和结构体变量d.name较大的那个赋给结构体变量d。通过函数strcmp比较。strcmp()函数有两个参数,分别为被比较的两个字符串。如果第一个字符串大于第二个字符串返回值大于0,若第一个小于第二个返回值小于0,相等时返回值为0。字符串比较大小的标准是从第一个字符开始依次向右比较,遇到某一个字符大,该字符所在的字符串就是较大的字符串,如果遇到某一个字符小,该字符所在的字符串就是较小的字符串。本程序中第一个if语句strcmp(a. name,b.name)>0为真,故将b的值赋给d,第二个if语句strcmp(c.name,d.name)>0为假,故不执行后面的语句,最后d的值为b的值,因此d.sno和p->name的值为 2002Shangxian。

阅读理解

Compared with other European countries, lifestyle in Italy is slower and more relaxing in its own way. Italians love to chat over a cup of coffee, go out for a walk in the middle of the day, and enjoy long lunches and dinners.

Family is important to Italians. They can’t think of spending a day without asking about their parents or children, and a weekend without a family lunch or dinner. Italians living outside their country also miss their family a lot.

Italians like simple life. Their days start and end with a cup of coffee. A cup of coffee after every meal is a must. Italians love to spend time over a hot cup of coffee and even hotter conversation with friends. Topics are usually about family, football and politics(政治).

Sport is a very important part in the lives of many Italians. Football is their favorite sport. There are hundreds of football clubs with top soccer teams in Italy. Also, many top players from all over the world play in Italy. Volleyball is also popular and so is rugby(橄榄球), with the top rugby team playing for the European Challenge Cup.

Every Italian province, city, town and street has a historical(历史的) even that took place there and the Italian calendar is filled with national holidays that they love to celebrate(庆祝).

小题1:We can learn from the first paragraph that ________.

A.most European countries have slow and relaxing lifestyles

B.the lifestyle in Italy isn’t much like that of the other countries in Europe

C.Italians enjoy chatting over a cup of tea and long dinners

D.Italians love to walk in the middle of the night小题2: What does the writer want to tell us in the second paragraph?

A.Friends are very important to Europeans.

B.Italians can’t spend a day without their parents.

C.Italians will never go to another country because they will miss their children.

D.Family is more important to Italians than any other thins.小题3: Which of the following sports is loved most by Italians?

A.Football.

B.Basketball.

C.Volleyball.

D.Rugby.小题4:Which of the following is TRUE according to the passage?

A.Italians love to spend national holidays, but there aren’t so many.

B.Italians never talk about politics with their family.

C.Italians like drinking coffee after every meal.

D.Soccer is not very popular in Italy.小题5:What’s the passage mainly about?

A.Italian family.

B.Italian life.

C.Italian sport.

D.Italian history.

问答题 简答题