滚丝机厂家
免费服务热线

Free service

hotline

010-00000000
滚丝机厂家
热门搜索:
行业资讯
当前位置:首页 > 行业资讯

当计算机三级C语言上机试题总结之五

发布时间:2021-09-10 23:25:05 阅读: 来源:滚丝机厂家

计算机三级C语言上机试题总结(之五)

{

clrscr() ;

if(ReadDat()) {

printf("数据文件T不能打开!\n\007") ;

return ;

}

StrOL() ;

WriteDat() ;

}

int ReadDat(void)

{

FILE *fp ;

int i = 0 ;

char *p ;

if((fp = fopen("T", "r")) == NULL) return 1 ;

while(fgets(xx[i], 80, fp) != NULL) {

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

if(p) *p = 0 ;

i++ ;

}

maxline = i ;

fclose(fp) ;

return 0 ;

}

void WriteDat(void)

{

FILE *fp ;

int i ;

clrscr() ;

fp = fopen("T", "w") ;

for(i = 0 ; i maxline ; i++) {

printf("%s\n", xx[i]) ;

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

}

fclose(fp) ;

}

t 内容本钱增加应当如下:

used be to fields several on field any on index an create c也提高了实验人员的安全性an

You

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

define and records specific to access quick you allow indexes

in keys

longer no you After file ISAM a of processing sequential for

orders

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

need

indexes other on or records data the on

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

may You

Employee the example For file the in records other all from

record

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

Number

other to numbers these reassign never you and employees

different

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

employees

determining of thouble the saves field 其中最大实验力为292.14Nunique this employee

specific

record correct the have you whether

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

If

you one the is record the whether determine and key your

matches the

others find to again search must you one correct the not is it

If want

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

If

only allow will ISAM and description key the in fact this

include can

are numbers employee the that specify you if example For keys

unique

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

unique

file int exist alreadly not do that numbers employee to

numbers

字符串处理之七

code:

/*

函数ReadDat( )实现从文件T中读取一篇英文文章存入

到字符串数组xx中; 请编制函数ConvertCharD(), 其函数的功能

是: 以行为单位把字符串中的所有小写字母改写成该字母的上一

个字母, 如果是字母a, 则改写成字母z,大写字母和其它字符保

持不变。把已处理的字符串仍按行重新存入字符串数组xx中。最

后main()函数调用函数WriteDat()把结果xx输出到文件T

中。

例: 原文: dza

hj

结果: cyz

gi

原始数据文件存放的格式是: 每行的宽度均小于80个字符, 含

标点符号和空格。

注意: 部分源程序存放在PROG1.C中。

请勿改动主函数main( )、读数据函数ReadDat()和输出数据函

数WriteDat()的内容。

*/

#include

#include

#include

char xx[50][80] ;

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

int ReadDat(void) ;

void WriteDat(void) ;

void ConvertCharD(void)

{/**/

int i,j;

for(i=0; i maxline; i++)

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

if(xx[i][j]=='a') xx[i][j]='z';

else if(islower(xx[i][j])) xx[i][j]-=1;

/**/

}

void main()

{

clrscr() ;

if(ReadDat()) {

printf("数据文件T不能打开!\n\007") ;

return ;

}

ConvertCharD() ;

WriteDat() ;

}

int ReadDat(void)

{

FILE *fp ;

int i = 0 ;

char *p ;

if((fp = fopen("T", "r")) == NULL) return 1 ;

while(fgets(xx[i], 80, fp) != NULL) {

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

if(p) *p = 0 ;

i++ ;

}

maxline = i ;

fclose(fp) ;

return 0 ;

}

void WriteDat(void)

{

FILE *fp ;

int i ;

clrscr() ;

fp = fopen("T", "w") ;

for(i = 0 ; i maxline ; i++) {

printf("%s\n", xx[i]) ;

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

}

fclose(fp) ;

}

t 文件⑵接好电源内容应当如下:

Ynt bzm bqdzsd zm hmcdw nm zmx ehdkc, nm rdudqzk ehdkcr sn ad

trdc

江苏订做西装
江苏定制西装
江苏定做西装
江苏设计西装