问题 问答题

函数fun的功能是:读入一个字符串(长度<20),将该字符串中的所有字符按ASCII码升序排序后输出。
例如,若输入:edcba,则应输出:abcde。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
[试题源程序]
#include<stdio.h>
void fun(char t[])

Char c;
int i,j;
/**********found***********/
for(i=strlen(t);i;i--)
for(j=0;j<i;j++)
/**********found***********/
if(t[j]<t[j+1])

c=[j];
t[j]=t[j+1];
t[j+1]=c;


main()

char s[81];
printf("\nPlease enter a character string:");
gets(s);
printf("\n\nBefore sorting:n\"%s\"",s);
fun(s);
printf("\nAfter sorting decendingly:\n\"%s\"",s);

答案

参考答案:(1)错误:for(i=strlen(t);i;i--)
正确:for(i=strlen(t)-1;i;i--);
(2)错误:if(t[j]<t[j+1])
正确:if(t[j]>t[j+1])

解析: 错误1:根据题意,有外for循环的初始值应是strlen(t)-1。
错误2:由于是按升序排序,所以应if(t[j]>t[j+1])。

阅读理解

                                      D

Wilma was born on June 23, 1940 in St Bethlehem, Tennesse. By the time she was 6, Wilma Rudolph was given metal braces (支架) to aid her in walking. She started receiving treatment with help from her family. A few years later, she walked without any assistance into the church.

When she was in junior high, she joined the basketball team. She finally made an appeal to compete in games again and when her wish was finally permitted, she amazed everyone by leading the team to an undefeated season and the state championships. Though they lost the championship title in the end, Wilma Rudolph earned the attention of the women’s track coach,Ed Template at Tennessee State University and was invited to join the "Tigerbelles".Her efforts paid off as she turned out to be so good that the Tigerbelles invited her to join them in the national Olympic team trails. Not only did she make it into the team, but she won a bronze medal in the 4×100 m relay at the 1956 Melbourne Olympics. Four years later, Rudolph set a world 200 m record (22.9 seconds) at the 1960 US Championships. At the Rome Olympics in 1960, she competed in the 100 m, 200 m and 4×100 m relay, and equaled the world record of 11.3 seconds in the semifinals (半决赛) of the 100 m. She won the final by three metres in 11.0 seconds, but it was not accepted as a world record.

Wilma Rudolph’s extraordinary achievements in Rome made her a darling of the European press who gave her the nickname "The Black Gazelle (羚羊)" and "The Black Pearl". She also became the first woman in American history to win 3 gold medals in the Olympics and was crowned "the Fastest Woman in the World", Wilma Rudolph’s spirit inspired people such as Jackie Joyner Kersee and Florence Griffith Joyner who became the next woman to win 3 gold medals.

小题1:What problem did Wilma face according to Paragraph 1?

A.Not being able to speak.

B.Not being able to walk.

C.Losing her sight.

D.Losing her hearing.小题2:We learn that Wilma broke the world record in________.

A.the 4×100m relay at the 1956 Melbourne Olympics

B.the semifinals of the 100m at the Rome Olympics

C.the 200m at the 1960 US Championships

D.the final of the 100m at the Rome Olympics小题3: How many people that at least won 3 Olympics gold medals in American history are

mentioned in the passage?

A.One.

B.Three.

C.Four.

D.Five.

单项选择题