av手机免费在线观看,国产女人在线视频,国产xxxx免费,捆绑调教一二三区,97影院最新理论片,色之久久综合,国产精品日韩欧美一区二区三区

試題

計算機三級網(wǎng)絡(luò)技術(shù)上機試題

時間:2025-04-22 19:30:05 試題 我要投稿

計算機三級網(wǎng)絡(luò)技術(shù)上機試題

  函數(shù)TeadDat()實現(xiàn)從文件夾IN.DAT中讀取一篇英文文章存入到字符串組xx中,

計算機三級網(wǎng)絡(luò)技術(shù)上機試題

  請編制函數(shù)SortCharD(),其函數(shù)的功能是:以行為單位對字符按從小到大的順序進

  行排列,排列后的結(jié)果仍按行重新存入字符串組xx中,最后調(diào)用函數(shù)wrintDat()把

  結(jié)果xx輸出到文件OUT2.DAT中。

  例:原文:dAe,BfC.

  CCbbAA

  結(jié)果:,.ABCdef

  DDCCBB

  #include

  #include

  #include

  char xx[50][80];

  int maxlien=0;

  int ReadDat(void);

  void WriteDat(void);

  void SortCharD(void);

  {

  //在此區(qū)域填寫你的答案。

  }

  void main

  {

  clrscr();

  if(ReadDat())

  {

  printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007");

  return;

  }

  SortCharD();

  WriteDat();

  }

  int ReadDat(void)

  {

  FILE *fp;

  int i=0;

  char *p;

  if((fp=fopen("IN.DAT","r"))==NULL)

  return 1;

  while(fgets(xx,80,fp)!=NULL)

  {

  p=strchr(xx,'\n');

  if(p)*p=0;

  i++;

  }

  maxlien=i;

  fclose(fp);

  return 0;

  }

  void WriteDat(void)

  {

  FILE *fp;

  int i;

  fp=fopen("OUT2.DAT","W");

  for(i=0;i

  {

  printf("%s\n",xx);

  fprintf(fp,"%s\n",xx);

  }

  fclose(fp);

  }

  【參考答案】:

  void SortCharD(void);

  {

  int i,j,k;

  char cTemp;

  int ip,iLen;

  for(i=0;i

  {

  ilen=strlen(xx);

  for(j=0;j

  {

  ip=j;

  for(k=j+1;k

  if(xx[k]

  ip=k;

  cTemp=xx[ip];

  xx[ip]=xx[j];

  xx[j]=cTemp;

  }

  }

  }

【計算機三級網(wǎng)絡(luò)技術(shù)上機試題】相關(guān)文章:

計算機三級上機試題09-24

計算機三級上機試題10-22

最新計算機三級網(wǎng)絡(luò)技術(shù)上機試題及答案09-04

計算機三級網(wǎng)絡(luò)技術(shù)上機考試題08-16

2016計算機三級考試網(wǎng)絡(luò)技術(shù)上機試題及答案10-05

2016年計算機三級網(wǎng)絡(luò)技術(shù)上機試題及答案07-29

2016計算機三級網(wǎng)絡(luò)技術(shù)上機考試沖刺試題08-19

2015計算機三級網(wǎng)絡(luò)技術(shù)上機考試沖刺試題10-31

2016最新三級網(wǎng)絡(luò)技術(shù)上機試題及答案08-20