问题 问答题

填空题请补充函数fun(),该函数的功能是:把字符串str中的字符按字符的ASCII码降序排列,处理后的字符串仍然保存在原串中,字符串及其长度作为函数参数传入。例如,如果输入“cdefgh”,则输出为“hgfedc”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:#include #define N 80void fun(char s[],int n){ int i, j; char ch; for(i=0;i

答案

参考答案:【1】i 【2】s[j]=s[i]

解析:填空1:本题采用选择法进行排序。选择法的算法思路是:如果有n个数则从头到倒数的第2个数一个一个往后走动,每走动一个数总是将这个数与其后的所有数进行两两比较,在比较时按题目要求的顺序将进行比较的这两个数排序(即交换)。理解了选择法的思路,则此空就非常简单了,应该填i。填空2:借助第三个变量交换两数的方法,非常重要也非常基础,必须要求掌握。

填空题
阅读理解

51---------

Successful people are nicer to those who are jealous of them, psychologists have found.

   The fear that they may become the target of malicious(恶意的)envy makes people act more helpfully toward people who they think might be jealous of them.

   Previous research found jealousy could be divided into benign and malicious envy. Those with benign envy were motivated to improve themselves, to do better so they could be more like the person they envied.52-------- The Dutch researchers then set out to question the effect on the target of the envy.

In lab experiments a group of people were made to feel like they would be maliciously envied by being told they would receive an award of five euros(欧元)53-------The researchers thought that the deserved prize would lead to benign envy, while the undeserved prize would lead to malicious envy.

   Then the volunteer was asked to give time-consuming advice to a potentially envious person.People who had reason to think they would be the target of malicious envy were more likely to take the time to give advice than targets of benign envy.

   In another experiment, an experimenter dropped a number of erasers on the floor as the volunteer was leaving.54-------- He said: 'This sort of serves a useful group function. We all think better-off people should share with others but that's not something we are inclined to do when we are better off..55----------  

A.Those who thought they would be maliciously envied were more likely to help him pick them up.

B.Helping others is a virtue.

C.However those with malicious envy wanted tobringthe more successful persondown.

D.Malicious envy. is terrible.E. This fear of envy can encourage us to behave in ways that improve the social interactions of the group.'

  F. People are more likely to help others if they think they are envious of them.

G.. Sometimes the prize was deserved and was based on the score they were told they had earned on a quiz. But sometimes it was not based on their score at all.