首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
函数ReadDat()实现从数据文件in.dat中读取一篇英文文章存入到字符串数组xx中l请编写函数SortCharA(),其函数的功能是:以行为单位对字符按从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组XX中。最后通过main()函数调用函
函数ReadDat()实现从数据文件in.dat中读取一篇英文文章存入到字符串数组xx中l请编写函数SortCharA(),其函数的功能是:以行为单位对字符按从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组XX中。最后通过main()函数调用函
admin
2013-12-10
50
问题
函数ReadDat()实现从数据文件in.dat中读取一篇英文文章存入到字符串数组xx中l请编写函数SortCharA(),其函数的功能是:以行为单位对字符按从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组XX中。最后通过main()函数调用函数WriteDat()。把结果XX输出到文件out.dat中。
例:原文:dAe,BfC.
CCbbAA
结果,ABCdef
AACCbb
原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。
【试题程序】
#include
#include
char xx[503 1803;
unsigned int maxline=0 1/*文章的总行数*/
int ReadDat(void);
void WriteDat(void);
void SortCharA(void)
{
}
void main()
{
if(ReadDat()){
printf(”数据文件IN.DAT不能打开!\n\007”);
return;
)
SortCharA();
WriteDat();
}
int ReadDat(void)
{
FII。E*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=j:
felose(fp);
return 0;
}
void WriteDat(void)
{
FILE*fp;
unsigned int i;
fp=fopen(“out.dat”,“W”);
for(i=0;i
printf(“%s\n”,xx
);
fprintf(fp,“%s\n”,xx[i3);
)
fclose(fp);
}
选项
答案
void SortCharA(void) { unsigned int i,j.kl /*定义变量*/ int temp; for(i=0;i
xx[i][k]) {temp=xx[i][j] xx[i][j]=xx[i][k]; xx[i][k]=temp; } }
解析
转载请注明原文地址:https://jikaoti.com/ti/1v37FFFM
本试题收录于:
三级数据库技术题库NCRE全国计算机三级分类
0
三级数据库技术
NCRE全国计算机三级
相关试题推荐
数据库系统的核心是
一个关系数据库文件中的各条记录
关系模式规范化的最起码的要求是达到第一范式,即满足
下面所列的条目中Ⅰ.语法检查Ⅱ.语义检查Ⅲ.用户存取权限检查Ⅳ.数据完整性检查当用户发出查询数据库数据的命令时,数据库管理系统需要进行的检查是
设平衡的二叉排序树(AVL树)的结点个数为n,则其平均检索长度为
若对一个已经排好了序的序列进行排序,在下列4种方法中,哪一种方法比较好?
若对一个已经排好序的序列进行排序,在下列4种方法中,哪种方法比较好?
有一个网络数据库应用系统,其中一台计算机A存有DBMS软件、所有用户数据和应用程序,其余各节点作为终端通过通信线路向A发出数据库应用请求,这种方式属于
随机试题
发展中国家为了吸引更多国际直接投资,加速本国经济发展,通过立法或采取行政措施给予外资以税收优惠及其他优惠,如___________、___________等。
用齿轮计算的机械加法器的发明者是()
由______导演的《党同伐异》一片奠定了“交替蒙太克”的电影美学基础。()
休克治疗时应用血管活性药物的目的是
寒证与热证常见的鉴别点是
A.反复发作性呼气性呼吸困难,可自行缓解或治疗后缓解B.咳嗽、胸痛C.咳大量脓痰或反复咯血D.午后低热、乏力、盗汗、纳差、消瘦E.高热、咳嗽支气管哮喘的特征性临床表现是()
摄影测量影像平面图的编制包括()。
甲制药厂为增值税一般纳税人。2016年4月发生如下经营业务:(1)以折扣方式销售应税药品一批,在同一张增值税专用发票的“金额”栏注明销售额20万元,“备注”栏注明折扣额4万元。(2)从国外进口一台设备,海关审定的完税价格为200万元,进口关税税率为10
下列各项中,()属于广西的国家一类口岸。
对必要共同诉讼而言,其诉讼标的是()。
最新回复
(
0
)