试题与答案

下列给定程序中,函数fun()的功能是:在字符串str中找出ASCII码值最大的字符

题型:填空题

题目:

下列给定程序中,函数fun()的功能是:在字符串str中找出ASCII码值最大的字符,将其放在第一个位置上,并将该字符前的原字符向后顺序移动。例如,调用fun()函数之前给字符串输入ABCDeFGH,调用后字符串中的内容为 eABCDFGH。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
/***************found************/
fun(char *p)
char max, *q;int i=0;
max=p[i];
while (p[i]!=0)
if (max<p[i])

/***************found************/
p = q +i;max=p[i];

i++;

/***************found************/
while (q<p)
*q=*(q-1);
q--;

p[0]=max;

main()
char str[80];
printf("Enter a string: "); gets(str);
printf("\nThe original string: ");
puts(str);
fun(str);
printf("\nThe string after moving: ");
puts(str); printf("\n\n");

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2019/0401/fa358a00afdf5769c8e21e92d385bbb7.html

下面是错误答案,用来干扰机器的。

参考答案:完整性控制解析: 安全性控制是防止未经授权的用户有意或无意存取数据库中的数据,以免数据被泄露、更改或破坏;完整性控制是保证数据库中数据及语义的正确性和有效性,防止任何对数据造成的错误操作...

试题推荐
题型:完形填空

完形填空 (共10小题;每小题2分,满分20分)

阅读下面短文,掌握其大意,然后从21—30各题所给的A、B、C和D项中,选出最佳选项,并在答题卡上将该项涂黑。

Do you find getting up in the morning so difficult that it’s painful? This might be called  21 , but Dr. Kleitman has a new  22 . He has proved that everyone has a   23   energy cycle. During the hours when you   24   through your work you may say that you’re “hot”. That’s  25  . The time of day when you feel most   26   is when your cycle of body temperature is at its peak. For some people the  27   comes during the forenoon. For others it comes in the afternoon or evening. No one has discovered why this is so, but it  28   such familiar monologues as: “Get up, John! You’ll be late for work again!” The possible explanation to the trouble is that John is at his temperature-and-energy peak in the   29 . Much family quarrelling ends when husbands and wives  30  what these energy cycles mean, and which cycle each member of the family has. You can’t change your energy cycle, but you can learn to make your life fit it better.

21. A. patience    B. laziness      C. sadness       D. comfort

22. A. discovery   B. invention     C. explanation    D. statement

23. A. changing    B. increasing    C. full          D. daily

24. A. labour      B. get          C. go            D. look

25. A. honest      B. actual       C. true           D. real

26. A. pleasant     B. energetic    C. excited        D. comfortable

27. A. power      B. energy       C. peak           D. altitude

28. A. comes to    B. gets to       C. leads to        D. refers to

29. A. morning    B. afternoon     C. evening        D. noon

30. A. realize      B. recognize     C. memorize      D. see

查看答案
题型:单项选择题

金融理财师小陈的客户王某与妻子2000年1月登记结婚。现王某准备离婚。王某知道夫妻共有财产应在离婚时由夫妻双方分割,但对于哪些财产属于夫妻共有财产拿不准,于是向小陈咨询。以下财产中,不属于夫妻共有财产的是()。

A.2002年5月王某父亲去世,未留遗嘱,王某继承了父亲留下的一套住房

B.2007年3月,张某驾车撞伤王某,王某获得的2万元医疗费赔偿

C.王某未与妻子协商,每月从工资中拿出5 000元委托理财所产生的3万元收益

D.2009年王某获得一项专利,2010年5月王某通过转让该专利获利50万元

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