题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-17 23:42:24

[简答题]读函数readDat( )的功能是从文件IN25.DAT中读取20行数据存放到字符串数组xx中(每行字符串长度均小于80)。请编制函数jsSort( ),该函数的功能是:以行为单位对字符串按下面给定的条件进行排序,排序后的结果仍按行重新存入字符串数组 xx中,最后调用写函数writeDat( )把结果xx输出到文件OUT25.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
处理后字符串 h g f e a b c d
9 8 7 6 1 2 3 4
注意:部分源程序已给出。
请勿改动主函数main( )、读函数readDat( )和写函数writeDat( )的内容。
试题程序:
#include <stdio.h>
#include <string.h>
#include <conio.h>
char xx[20] [80];
void jsSort( )


main ( )

readDat ( );
jsSort ( );
writeDat ( );

readDat ( )

FILE *in;
int i=0;
char *p;
in = fopen("IN25.DAT ", "r ");
while(i〈20 && fgets(xx[i], 80, in) != NULL)

p = strchr(xx[i], ’/n’);
if(p) *p = 0;
i++;

更多"读函数readDat( )的功能是从文件IN25.DAT中读取20行数"的相关试题:

[多项选择]读函数readDat( )的功能是从文件IN25.DAT中读取20行数据存放到字符串数组xx中(每行字符串长度均小于80)。请编制函数jsSort( ),该函数的功能是:以行为单位对字符串按下面给定的条件进行排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用写函数writeDat( )把结果xx输出到文件OUT25.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
处理后字符串 h g f e a b c d
9 8 7 6 1 2 3 4
注意:部分源程序已给出。
请勿改动主函数main( )、读函数readDat( )和写函数writeDat( )的内容。
试题程序:
#include 〈stdio.h>
#include 〈string.h>
#include 〈conio.h>
char xx[20] [80]; void jsSort( )
main ( )

readDat ( );
jsSort ( );
writeDat ( );
readDat ( )

FILE *in;
int i=0;
char *p;
in = fopen("IN25.DAT", "r");
while(i〈20 && fgets(xx[i], 80, in) != NULL)

p = strchr(xx[i], ’/n’);
if(p) *p = 0;
i++;

fclose(in);
writeDat ( )

FILE *out
[简答题]读函数readDat( )的功能是从文件IN76.DAT中读取20行数据并存放到字符串数组xx中(每行字符串长度均小于80)。请编制函数jsSort( ),该函数的功能是:以行为单位对字符串按下面给定的条件进行排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用写函数writeDat( )把结果xx输出到文件OUT76.DAT中。
条件:从字符串中间一分为二,左边部分按字符的ASCII值升序排序,排序后,左边部分与右边部分按例子所示进行交换。如果原字符串长度为奇数,则最中间的字符不参加处理,字符仍放在原位置上。
注意:部分源程序已给出。
请勿改动主函数main( )、读函数readDat( )和写函数writeDat( )的内容。
试题程序:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char xx[20][80];
void readDat( );
void writeDat( );
void jsSort( )


void main( )

readDat( );
jsSort( );
writeDat( );

void readDat( )

FILE * in;
int i=0;
char * p;
in=fopen("in76.dat","r");
while(i<20 && fgets(xx[i],80,in)!=NULL)

p=strchr(xx[i],’/n’);
if(p)*p=0;
i + +;

fclose(in);

void writeDat( )

FILE * out;
int i;
system("CLS");
out=fopen("out76.dat","w");
for(i=0;i<20;i + +)

printf("% s/n
[简答题]读函数ReadDat( )的功能是实现从文件IgNG52.IN中读取一篇英文文章,并存入到字符串数组xx中。请编制函数encryptChar( ),按给定的替代关系对数组xx中的所有字符进行替代,结果仍存入数组xx的对应的位置上,最后调用写函数WriteDat( )把结果xx输出到文件PS52.DAT中。
替代关系:f(P)=P*11 mod 256(P是数组xx中某一个字符的ASCⅡ值,f(P)是计算后新字符的ASCⅡ值),如果计算后f(P)的值小于等于32或f(P)对应的字符是小写字母,则该字符不变,否则将f(P)所对应的字符进行替代。
注意:部分源程序已给出。
原始数据文件存放的格式是:每行的宽度均小于80个字符。
请勿改动主函数main( )、读函数ReadDat( )和写函数WriteDat( )的内容。
[试题程序]
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
unsigned char xx[50][80];
int maxline=0;/*文章的总行数*/
int ReadDat(void);
void WriteDat(void);
void encryptchar( )


voidmain( )

system("CLS");
if(ReadDat( ))

printf("数据文件ENG52.IN不能打开!/n/007");
return;

encryptChar( );
WriteDat( );

int ReadDat(void)

FILE*fp;
int i=0;
unsigned char*P:
if((fp=fopen("ENG52.IN","r"))==NULL)
return 1;
while(fgets(xx[i],80,fp)!=NULL)

P+strc
[简答题]读函数ReadDat( )实现从文件ENG28.IN中读取一篇英文文章,存入到字符串数组xx中。请编制函数 encryptChar( ),按给定的替代关系对数组xx中的所有字符进行替代,仍存入数组xx的对应的位置上,最后调用写函数WriteDat( )把结果xx输出到文件PS28.DAT中。
替代关系:f(p)=p*11 mod 256(p是数组xx中某一个字符的ASCII值,f(p)是计算后新字符的ASCII值),如果计算后f(p)的值小于等于32或f(p)对应的字符是小写字母,则该字符不变,否则将f(p)所对应的字符进行替代。
注意:部分源程序已给出。
原始数据文件存放的格式是:每行的宽度均小于80个字符
请勿改动主函数main( )、读函数ReadDat( )和写函数WriteDat( )的内容。
试题程序:
#include 〈stdio.h>
#include 〈string.h>
#include 〈conio. h>
#include 〈ctype. h>
unsigned char xx[50] [80];
int maxline = 0; /* 文章的总行数 */
int ReadDat (void);
void WriteDat(void); void encryptChar( )
main ( )

clrscr ( );
if (ReadDat ( ))

printf("数据文件ENS28.IN不能打开! /n/007");
return;

encryptChar ( );
WriteDat ( );
int ReadDat (void)

FILE *fp;
int i = 0;
unsigned char *p;
if((fp = fopen("ENG28.IN", "r")) ==NULL)
return 1;
while(fgets(xx[i
[简答题]函数ReadDat( )实现从文件in.dar中读取20行数据存放到字符串数组xx中(每行字符串长度均小于80)。请编制函数jsSort( ),其函数的功能是:以行为单位对字符串按给定的条件进行排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用函数WriteDat( )把结果xx输出到文件out.dat中。
条件:从字符串中间一分为二,左边部分按字符的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
则处理后字符串 h g f e d c b a
8 7 6 5 9 4 3 2 1
部分源程序已经给出。
请勿改动主函数main( )、读数据函数ReadDat( )和输出数据函数WriteDat( )的内容。
#include <stdio.h>
#include <string.h>
#include <conio.h>
char xx[20][80];
void jsSort( )


void main( )

ReadDat( );
jsSort( );
WriteDat( );

ReadDat( )

FILE *in;
int i=0;
char *p;
in=fopen("in.dat","r");
while(i<20&&fgets(xx[i],80,in)!=NULL)

p=strchr(xx[i],’In’);
if(p)*p=0;
i++;

fclose(in);

WriteDat( )

FILE *ou
[简答题]函数readDat ( )是从文件in71.dat中读取20行数据存放到字符串数组xx中(每行字符串长度均小于80)。请编制函数jsSort( ),其功能是:以行为单位对字符串按下面给定的条件进行排序,排序后的结果仍按行重新存八字符串数组xx中。最后调用函数writeDat( )把结果xx输出到文件out71.dar中。
条件:从字符串中间一分为二,左边部分按字符的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 c f g h
4 3 2 1 9 5 6 7 8
注意:部分源程序已给出。
请勿改动主函数main( )、读函数readDat( )和写函数writeDat( )的内容。
试题程序:
# include <stdio.h>
# include <string.h>
# include <conio. h>
char xx[20] [80];
void jsSort( )


void main ( )

readDat ( );
jsSort ( );
writeDat ( );

readDat ( )

FILE *in;
int i=0;
char *p;
in=fopen("in71.dat","r");
while (i<20 && fgets(xx[i],80,in) !=NULL)

p=strchr(xx[i], ’/n’);
if (p)
*p= 0;
i++;

fclose (in);

writeDat
[多项选择]函数readDat( )是从文件IN.DAT中读取20行数据存放到字符串数组XX中(每行字符串长度均小于80)。请编制函数jsSort( ),其功能是:以行为单位对字符串按下面给定的条件进行排序,排序后的结果仍按行重新存入字符串数组XX中,最后调用函数writeDat( )把结果XX输出到文件OUT.DAT中。条件:从字符串中间一分为二,左边部分按字符的ASCⅡ值降序排序,右边部分按字符的ASCⅡ值升序排序。如果原字符串长度为奇数,则最中间的字符不参加排序,字符仍放在原位置上。
例如,位置 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文件中。请勿改动数据文件IN.DAT中的任何数据、主函数main( )、读函数readDat( )和写函数writeDat( )的内容。
[试题程序]
#include
#include
char XX[20][80];
void readDat( );
void writeDat( );
void jsSort( )


void main( )

readDat( );
jsSort( );
writeDat( );

void readDat( )

FILE *in;
int i=0;
char *p;
in=fopen("in.dat","r");
while(i<20&&fgets(xx[i],80,in)!=NULL)
p=strchr(xx[i],’/n’);
if(p) *P=0;
i++;

fclose(in);

void writeDat( )

FILE *out;
int i;
out=fop
[简答题]函数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
注意:部分源程序已经给出。
请勿改动主函数main( )、读数据函数ReadDat( )和输出数据函数WriteDat( )的内容。
#include<stdio.h>
#include<string.h>
#include<conio.h>
char xx[20][80];
void jsSort( )


void ReadDat( )

FILE *in;
int i=0;
char *p;
in=fopen("in.dat","r");
while(i<20&&fgets(xx[i],80,in)!=NULL)

p=strchr(xx[i],’/n’);
if(p)
*p=0;
i++;

fclose(in);

void WriteDat( )

FILE *out;
int i;
out=fopen("out.dat","w");
for(i=0; i<20;i++)

printf("%s/n",xx[i]);
fprintf(
[简答题]函数readDat( )是从文件in77.dat中读取20行数据并存放到字符串数组xx中(每行字符串长度均小于80)。请编制函数jsSort( ),其功能是:以行为单位对字符串按下面给定的条件进行排序,排序后的结果仍按行重新存入字符串数组xx中。最后调用函数writeDat( )把结果xx输出到文件out77.dat中。
条件:从字符串中间一分为二,左边部分按字符的ASCII值降序排序,右边部分按字符的ASCII值升序排序。如果原字符串长度为奇数,则最中间的字符不参加排序,字符仍放在原位置上。
注意:部分源程序已给出。
请勿改动主函数main( )、读函数readDat( )和写函数writeDat( )的内容。
试题程序:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char xx[20][80];
void readDat( );
void writeDat( );
void jsSort( )


void main( )

readDat( );
jsSort( );
writeDat( );

void readDat( )

FILE * in;
int i=0;
char * p;
in=fopen("in77.dat","r");
while(i<20 && fgets(xx[i],80,in)!=NULL)

p=strchr(xx[i],’/n’);
if(p)
*p=0;
i + +;

fclose(in);

void writeDat( )

FILE * out;
int i;
system("CLS");
out=fopen("out77.dat","w");
for(i=0;i<20;i + +)

printf("% s/n",xx[i
[多项选择]函数readDat( )的功能是从文件in52.dat中读取20行数据存放到字符串数组xx中(每行字符串的长度均小于80)。请编制函数JsSod( ),该函数的功能是:以行为单位对字符串变量的—F标为奇数位置上的字符按其 ASCII值从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用函数writeDat( )把结果xx输出到文件out52.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( )的内容。
试题程序:
#include<stdio. h>
#include<string. h>
#include<conio. h>
char xx[20] [80]; void jsSort
void main ( )

readDat ( );
jsSort ( );
writeDat ( );
readDat ( )

FILE *in;
int i=0;
char *p;
in=fopen ( "in52. dat", "r" );
while(i<20 && fgets(xx[i],80,in) !=NULL)

p=strchr (xx[i], ’ In’ );
if(p) *p=0;
i++;

fclose (in);
writeDat ( )

FILE *out;
int i;
out=fopen ("out52 .dat", "w");
clrscr ( );

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码