| 网站首页 | 文秘公文 | 免费试题 | 教学用文 | 优秀教案 | 各类考试 | 
您现在的位置: 东星资源网 >> 各类考试 >> 计算机等级考试 >> 最新动态 >> 正文
计算机等级考试上机100题(三级)
计算机等级考试上机100题(三级)

  1. 函数ReadDat()从文件ENG.IN中读取一篇英文文章,存入到字符串数组xx中;请编制函数encryptChar(),按给定的替代关系对数组xx中的所有字符替代,仍存入数组xx的对应的位置上,最后调用函数WriteDat()把结果xx输出到文件PS10.DAT中。

  替代关系:f(p)=p*11 mod 256 (p是数组中某字符的ASCII值,f(p)是计算后新字符的ASCII值),原字符的ASCII值是偶数或计算后f(p)值小于等于32,则该字符不变,否则将f(p)所对应的字符替代。源程序已给出,原始数据文件存放的格式是:每行的宽度均小于80个字符。请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。

  #include

  #include

  #include

  #include

  unsigned char xx[50][80];

  int maxline=0;/*文章的总行数*/

  int ReadDat(void)

  void WriteDat(void)

  void encryptChar()

  { int i,j;

  char *p;

  for(i=0;i='a'&&xx[j]='0'&&p='A'&&p='0'&&xx[j]='A'&&xx[j]='a'&&p130)

  ;

  else xx[j]=p; } }

  11.函数ReadDat()从文件in.dat中读取20行数据存放到字符串数组xx中(第行字符串长度均小于80)。请编制函数jsSort(),其函数的功能是:以对字符串按给定的条件排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用函数WriteDat()把结果xx输出到文件out.dat中。

  条件:从字符串中间一分为二,左边按字符的ASCII值升序排序,排序后左边与右边交换。原字符串长度为奇数,则最中间的字符不参加,字符仍原位置上。

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

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

  4 3 2 1 9 8 7 6 5

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

  8 7 6 5 9 1 2 3 4

  源程序已给出。 请勿改动主函数main()、读函数ReadDat()和写函数WriteDat()的内容。

  #include

  #include

  #include

  char xx[20][80];

  void jsSort()

  { int i,j,k,m;

  char c;

  for(i=0;ixx[m])

  { c=xx[j];

  xx[j]=xx[m];

  xx[m]=c; }

  for(j=0;jxx[m])

  { c=xx[j];

  xx[j]=xx[m];

  xx[m]=c; } }

  }

  14.函数ReadDat()从文件in.dat中读取20行数据存放到字符串数组xx中(第行字符串长度均小于80)。请编制函数jsSort(),其函数的功能是:以对字符串变量的下标为奇数的字符按其ASCII值从小到大的顺序排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用函数WriteDat()把结果xx输出到文件out.dat中。

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

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

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

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

  void jsSort()

  { int i,j,k,m;

  char c;

  for(i=0;ixx[m])

  { c=xx[j];

  xx[j]=xx[m];

  xx[m]=c; } } }

  15.函数ReadDat()从文件in.dat中读取20行数据存放到字符串数组xx中(第行字符串长度均小于80)。请编制函数jsSort(),其函数的功能是:以对字符串按给定的条件排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用函数WriteDat()把结果xx输出到文件out.dat中。条件:从字符串中间一分为二,右边按字符的ASCII值升序排序,排序后左边与右边交换。原字符串长度为奇数,则最中间的字符不参加排序,字符仍原位置上。

  例如:位置 0 1 2 3 4 5 67 8

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

  8 7 6 5 9 1 2 3 4

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

  5 6 7 8 9 4 3 2 1

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

  void jsSort()

  { int i,j,k,m,n;

  char c;

  for(i=0;ixx[m])

  { c=xx[j];

  xx[j]=xx[m];

  xx[m]=c; }

  for(j=0;jxx[m])

  { c=xx[j];

  xx[j]=xx[m];

  xx[m]=c; }

  if(k%2==0)

  n=k/2;

  else n=k/2+1;

  for(j=n;jn)

  { c=aa;

  aa=aa[j];

  aa[j]=c; }

  if(m==n)

  { if(aa(aa.x2+aa.x3))

  bb[k++]=aa;

  for(i=0;ibb[j].x1+bb[j].x3)

  { m=bb;

  bb=bb[j];

  bb[j]=m; }

  return k;

  }

  void main()

  { int count;

  readDat();

  count=jsSort(); /*返回条件的个数*/

  writeDat(count); }

  readDat(int count)

  { FILE *in;

  int i;

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

  for(i=0; ia[j].s)

  { *s=a;

  a=a[j];

  a[j]=*s; }

  return a[0].s;

  }

  main()

  {

  STU a[N]={ {"A01",81},{"A02",89},{"A03",66},{"A04",87},{"A05",77},

  {"A06",90},{"A07",79},{"A08",61},{"A09",80},{"A10",71} }, m ;

  int i;

  clrscr();

  printf("***** The original data *****\n");

  for(i=0; i0;m++)

  if(isP(m))

  { xx[i++]=m;

  k--; } }

  main()

  {

  int m, n, xx[1000] ;

  clrscr() ;

  printf("\nPlease enter two integers:") ;

  scanf("%d%d", &m, &n ) ;

  num(m, n, xx) ;

  for(m = 0 ; m sell[j].je)

  { c=sell;

  sell=sell[j];

  sell[j]=c; } } }

  33..已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),sl(整型),金额je(长整型)四组成。:金额=单价*计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品名称从大到小排列,若产品名称相同,则按金额从大到小排列,排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT6.DAT中。

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

  void SortDat()

  { int i,j;

  PRO c;

  for(i=0;isell[j].je)

  { c=sell;

  sell=sell[j];

  sell[j]=c; }

  else

  if(sell.je==sell[j].je)

  if(strcmp(sell.dm,sell[j].dm)sell[j].je)

  { c=sell;

  sell=sell[j];

  sell[j]=c; }

  else

  if(sell.je==sell[j].je)

  if(strcmp(sell.dm,sell[j].dm)>0)

  { c=sell;

  sell=sell[j];

  sell[j]=c; } } }

  37.已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),sl(整型),金额je(长整型)四组成。:金额=单价*计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按金额从大到小排列,若金额相等,则按产品代码从小到大排列,排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT3.DAT中。源程序已给出。

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

  void SortDat()

  { int i,j;

  PRO c;

  for(i=0;i0)

  { c=sell;

  sell=sell[j];

  sell[j]=c; } } }

  38.已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),sl(整型),金额je(长整型)四组成。:金额=单价*计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品名称从小到大排列,若产品名称相等,则按金额从小到大排列,排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT5.DAT中。源程序已给出。请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。

  void SortDat()

  { int i,j;

  PRO c;

  for(i=0;i0)

  { c=sell;

  sell=sell[j];

  sell[j]=c; }

  else

  if(strcmp(sell.mc,sell[j].mc)==0)

  if(sell.je>sell[j].je)

  { c=sell;

  sell=sell[j];

  sell[j]=c; } } }

  39.已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),sl(整型),金额je(长整型)四组成。:金额=单价*计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品名称从大到小排列,若产品名称相等,则按金额从小到大排列,排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT7.DAT中。源程序已给出。请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。

  void SortDat()

  { int i,j;

  PRO c;

  for(i=0;isell[j].je)

  { c=sell;

  sell=sell[j];

  sell[j]=c; } } }

  40.已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),sl(整型),金额je(长整型)四组成。:金额=单价*计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品代码从小到大排列,若产品代码相等,则按金额从小到大排列,排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT9.DAT中。源程序已给出。请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。

  void SortDat()

  { int i,j;

  PRO c;

  for(i=0;i0)

  { c=sell;

  sell=sell[j];

  sell[j]=c; }

  else

  if(strcmp(sell.dm,sell[j].dm)==0)

  if(sell.je>sell[j].je)

  { c=sell;

  sell=sell[j];

  sell[j]=c; } } }

  41.请编写函数jsvalue(int m,int k,int xx[]),该函数的功能是:将大于整数m且紧靠m的k个素数存入数组xx传回。最后调用函数writeDat()读取10组数据,分别得出结果且把结果输出到文件out.dat中。例如:若输入17,5,则应输出:19,23,29,31,37。请勿改动主函数main()和写函数writeDat()的内容。

  #include

  int ss(int k)

  { int i,j;

  j=1;

  for(i=2;i if(k%i==0) j=0;

  return j; }

  void jsvalue(int m,int k,int xx[])

  { int i=0;

  for(m=m+1;k>0;m++)

  if(ss(m))

  { xx[i++]=m;

  k--; } }

  main()

  {int m,n,zz[100];

  printr(\"\\n请输入两个整数:\");

  scanf(\"%d%d\",&m,&n);

  jsvalue(m,n,zz);

  for(m=0;maa[j])

  { k=aa;

  aa=aa[j];

  aa[j]=k; } }

  for(i=0;i(aa.x1+aa.x3))

  bb[m++]=aa;

  for(i=0;i0;m--)

  a[m]=a[m-1];

  a[0]=c; } }

  }

  main()

  {int a={{6,8,9,1,2,5,4,7,3},

  {3,5,8,9,1,2,6,4,7},

  {8,2,1,9,3,5,4,6,7},

  {3,5,1,2,9,8,6,7,4},

  {4,7,8,9,1,2,5,3,6},

  {4,7,3,5,1,2,6,8,9},

  {9,1,3,5,8,6,2,4,7},

  {2,6,1,9,8,3,5,7,4},

  {5,3,7,9,1,8,2,6,4},

  {7,1,3,2,5,8,9,4,6}, };

  int i,j;

  jsvalue(a);

  for(i=0;i=100) b[0]=k;

  if(sn=1000) b=k;

  if(sn=10000)

  { b=k;

  break; }

  sn=sn+an;

  a1=a2;

  a2=an;

  k++; }

  }

  main()

  {jsvalue();

  printf(\"M=100,n=%d\\nM=1000,n=%d\\nM=10000,n=%d\\n\",b[0],b,b);

  writeDat() }

  writeDat()

  {FILE *fp;

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

  fprintf(fp,\"%d\\n%d\\n%d\\n\",b[0],b,b);

  fclose(fp); }

  OUT.DAT文件

  6

  9

  11

  47---56题in.dat文件

  You can create an index on any field, on several fields to be used

  together, or on parts thereof, that you want to use as a key. The

  keys in indexes allow you quick access to specific records and define

  orders for sequential processing of a ISAM file. After you no longer

  need an index, you can delete it. Addition and indexes have no effect

  on the data records or on other indexes.

  You may want a field in field in each record to uniquely identify that

  record from all other records in the file. For example, the Employee

  Number field is unique if you do not assign the same number to two

  different employees, and you never reassign these numbers to other

  employees. If you wish to find or modify the record belonging to a

  specific employee, this unique field saves the thouble of determining

  whether you have the correct record.

  If you do not have a unique field, you must find the first record

  the matches your key and determine whether the record is the one you

  want. If it is not the correct one, you must search again to find others.

  If you know that you have a unique field within your records, you

  can include this fact in the key description, and ISAM will allow only

  unique keys. For example, if you specify that the employee numbers are

  unique, ISAM only lets you add records to the file for, or change

  numbers to, employee numbers that do not alreadly exist int file.

  47..函数ReadDat()从文件IN.DAT中读取一篇英文文章存 入到字符串数组xx中,请编制函数CharConvA(),其函数的功能是:以把字符串中的最后字符的ASCII值右移4位后加最后个字符的ASCII值,最后新的字符,最后个字符的ASCII值右移4位后加最后个字符的ASCII值,最后个新的字符,依此类推一直个字符,个字符的ASCII值加原最后字符的ASCII值,个新的字符,的新字符分别存原字符串对应的位置上。最后已的字符串仍按行重新存入字符串数组xx中,最后调用函数writeDat()把结果xx输出到文件OUT10.DAT中。原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。源程序已给出。请勿改动主函数main()和写函数writeDat()的内容。

  #include

  #include

  #include

  char xx[50][80] ;

  int maxline = 0 ; /* 文章的总行数 */

  int ReadDat(void) ;

  void WriteDat(void) ;

  void CharConvA(void)

  { int i,j;

  char p,c;

  for(i=0;i { p=xx[strlen(xx)-1];

  c=xx[0];

  for(j=strlen(xx)-1;j>0;j--)

  xx[j]=(xx[j]>>4)+xx[j-1];

  xx[0]=p+c; }

  }

  void main()

  {

  clrscr() ;

  if(ReadDat()) {

  printf("数据文件IN.DAT打开!\n\007") ;

  return ;

  }

  CharConvA() ;

  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++ ;

  }

  maxline = i ;

  fclose(fp) ;

  return 0 ;

  }

  void WriteDat(void)

  {

  FILE *fp ;

  int i ;

  clrscr() ;

  fp = fopen("OUT10.DAT", "w") ;

  for(i = 0 ; i >4)+xx[j];

  }

  void main()

  {

  clrscr() ;

  if(ReadDat()) {

  printf("数据文件IN.DAT打开!\n\007") ;

  return ;

  }

  StrCharJR() ;

  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++ ;

  }

  maxline = i ;

  fclose(fp) ;

  return 0 ;

  }

  void WriteDat(void)

  {

  FILE *fp ;

  int i ;

  clrscr() ;

  fp = fopen("OUT8.DAT", "w") ;

  for(i = 0 ; i ='b'&&xx[j]100))

  xx[j]+=c; }

  }

  void main()

  {

  clrscr() ;

  if(ReadDat()) {

  printf("数据文件IN.DAT打开!\n\007") ;

  return ;

  }

  StrCharJL() ;

  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++ ;

  }

  maxline = i ;

  fclose(fp) ;

  return 0 ;

  }

  void WriteDat(void)

  {

  FILE *fp ;

  int i ;

  clrscr() ;

  fp = fopen("OUT7.DAT", "w") ;

  for(i = 0 ; i 100))

  xx[j]+=c; }

  }

  void main()

  {

  clrscr() ;

  if(ReadDat()) {

  printf("数据文件IN.DAT打开!\n\007") ;

  return ;

  }

  StrCharJL() ;

  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++ ;

  }

  maxline = i ;

  fclose(fp) ;

  return 0 ;

  }

  void WriteDat(void)

  {

  FILE *fp ;

  int i ;

  clrscr() ;

  fp = fopen("OUT7.DAT", "w") ;

  for(i = 0 ; i 想要的请留信箱啊!

(文章来源:招生考试在线)

下载<<计算机等级考试上机100题(三级)>>Word文档 ,本文由东星资源网收集,版权归原作者所有
文章录入:admin    责任编辑:admin 
  • 上一个文章:

  • 下一个文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    相关最新动态 最新热点 最新推荐
    名师指点:历年考研数学重点…
    迈入六月天 2010考研大纲出来…
    我的暑期我做主:2010考研数…
    2010年考研数学线性代数解题…
    专家指导:2010年考研数学命…
    2010年考研数学指导:掌握学…
    名师指点:搜索2010考研数学…
    六月备考:为你量身定制2010…
    2010年考研数学复习名师忠言…
    我的暑期我做主:成就2010年…
      各类考试导航:
    英语四六级考试试题   英语作文   技巧心得   复习指南
    公务员考试最新资讯   申论试题   行政职业能力   公务员面试试题   专业科目试题   公共科目试题   考试攻略   时事政治
    成人高考语文复习   英语复习   史地复习   理化复习   数学(文)   数学(理)   政治复习
    计算机等级考试最新动态   历年试题   政策说明   经验交流
    职称英语理工类   卫生类   综合类   经验交流
    商务英语
    护士执业考试临床护理   基础护理学   心理护理    中医护理
    考研资料工程硕士   MBA   法律硕士    在职研究生   同等学历   心得指南