考试网 >> IT认证 >> 水平 >> 程序员 >> 赛迪网校11月软考模拟试题程序员下午

赛迪网校11月软考模拟试题程序员下午

发布时间:2006-06-28 02:28     点击:
分页:上一页  1 2 3 [4] 5 6 7 8 9 10  下一页

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

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

  部分源程序已给出。

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

#include<stdio.h>

#include<string.h>

char dat[20][80];

void jsSort()

{ int i,j,k,strl;

 char ch;

 for(i=0;i<20;i++)

 { strl=strlen(dat[i]);

  for(j=   (1)   ;j<strl;j++)//处理后半部分的字符串

     for(k=j+1;k<strl;k++)

      if(    (2)    )

       {

       ch=dat[i][j];

       dat[i][j]=dat[i][k];

       dat[i][k]=ch;

       }

  for(j=0;     (3)     ;j++)

  {

   ch=dat[i][j];

   dat[i][j]=dat[i][(strl+1)/2+j];

   dat[i][(strl+1)/2+j]=ch;

  }

 }

}

readDat()

{ FILE *in;

 int i=0;

 char *p;

      (4)     ;

 while(i<20&&fgets(dat[i],80,in)!=NULL)

 { p=strchr(dat[i],'\n');

  if(p)*p=0;

  i++;

 }

 fclose(in);

}

writeDat()

{ FILE *out;

 int i;

 out=fopen("out.dat","w");

 for(i=0;i<20;i++)

 { printf("%s\n" ,dat[i]);
分页:上一页  1 2 3 [4] 5 6 7 8 9 10  下一页
版权申明:未经书面授权请勿转载本站信息!!作品版权归所属媒体与作者所有!!
发表评论: 匿名发表 用户名: 查看评论
您将承担一切因您的行为、言论而直接或间接导致的民事或刑事法律责任
留言板管理人员有权保留或删除其管辖留言中的任意内容
本站提醒:不要进行人身攻击。谢谢配合。
在本站搜索相关信息
2003-2005 Ksw123.com All Rights Reserved. - TOP
Copyright © 2006 Ksw123.com. All rights reserved.中国考题网 版权所有