三九宝宝网宝宝百科宝宝知识

全国计算机等级考试二级C语言上机题71

10月30日 编辑 39baobao.com

[职称英语等级考试模拟题理工类AB级]第1部分 词汇 选择(第1-15题,每题1分,共15分,建议10分钟以内完成)下面共有15句子,每个句子均有一个词或短语划有底横线,请从每个句子后面所给的四个选项中选择一个与划线部分意义...+阅读

★题目71

函数readdat()实现从文件in.dat中读取20行数据存放到字符串数组xx中(每行字符串长度均小于80)。请编制函数jssort(),其函数的功能是:以行为单位对字符串按给定的条件进行排序,排序后的结果仍按行重新存入字符串数组xx中,后调用函数writedat()把结果xx输出到文件out.dat中。

 条件:从字符串中间一分为二,左边部分按字符的ascii值降序排序,右边部分按字符的ascii值升序排序。如果原字符串长度为奇数,则中间的字符不参加排序,字符仍放在原位置上。

 例如:位置 0 1 2 3 4 5 6 7 8

 源字符串 a b c d h g f e

 1 2 3 4 9 8 7 6 5

 则处理后字符串 d c b a e f g h

 4 3 2 1 9 5 6 7 8

 部分源程序存在文件prog1.c中。

 请勿改动主函数main()、读数据函数readdat()和输出数据函数writedat()的内容。

&emspinclude

&emspinclude

&emspinclude



char xx[20][80];



void jssort()

{int i,j,k,strl,half;

 char ch;

 for(i=0;ixx[i][k]) {ch=xx[i][j];xx[i][j]=xx[i][k];xx[i][k]=ch;}

 }

}





void main()

{

 readdat();

 jssort();

 writedat();

}



readdat()

 {

 file *in;

 int i=0;

 char *p;



 in=fopen("in.dat","r");

 while(i

以下为关联文档:

职称英语等级考试模拟题综合类AB级第1部分 词汇 选择(第1-15题,每题1分,共15分,建议10分钟以内完成)下面共有15句子,每个句子均有一个词或短语划有底横线,请从每个句子后面所给的四个选项中选择一个与划线部分意义...

2009年度全国职称外语等级考试用书目录书 名 单价(元) 订数(册) 全国专业技术人员职称英语等级考试大纲 20 全国专业技术人员职称日语等级考试大纲 18 全国专业技术人员职称俄语等级考试大纲 11 全国专业技术人员职称...

全国职称外语等级考试综合类概括大意7PASSAGE 14  Earthquake Every year earthquakes are responsible for a large number of deaths and a vest amount of destruction in various parts of the world. Mos...

全国职称外语等级考试综合类概括大意2PASSAGE 3  Science Fiction Amongst the most popular books being written today are those which are usually classified as science fiction. Hundreds of titles ar...

全国职称外语等级考试综合类概括大意3PASSAGE 5  Recreation and Sports “All work and no play makes Jack a dull boy” is a popular saying in the United States. Other countries he similar sayings....

全国职称外语等级考试综合类概括大意6PASSAGE 12  Adult Education Voluntary learning in anized courses by mature men and women is called adult education. Such education is offered to make people a...

全国职称外语等级考试综合类概括大意4PASSAGE 8  Radio and Television There are few homes in Britain today that do not he either a radio or television set. Both of them he bee an essential part of...

全国职称英语等级考试阅读题Passage 2 Football is, I believe, the most popular game in England: one has only to go to one of the important matches to see this. Rich and poor, young and old...

全国职称外语等级考试综合类概括大意1PASSAGE 1  Successful Language Learners Some people seem to he a knack for learning languages. They can pick up new vocabulary, master rules or grammar, and lea...

推荐阅读
图文推荐