首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
函数ReadDat()实现从数据文件in.dat巾读取一篇英文文章存入到字符串数组xx中,请编写函数ConvertCharA(),其函数的功能是:以行为单位把字符串中的所有小写字母改写成该字母的下一个字母。如果是字母z,则改写成字母a.大写字母和其他字符保
函数ReadDat()实现从数据文件in.dat巾读取一篇英文文章存入到字符串数组xx中,请编写函数ConvertCharA(),其函数的功能是:以行为单位把字符串中的所有小写字母改写成该字母的下一个字母。如果是字母z,则改写成字母a.大写字母和其他字符保
admin
2013-12-10
26
问题
函数ReadDat()实现从数据文件in.dat巾读取一篇英文文章存入到字符串数组xx中,请编写函数ConvertCharA(),其函数的功能是:以行为单位把字符串中的所有小写字母改写成该字母的下一个字母。如果是字母z,则改写成字母a.大写字母和其他字符保持不变,把已处理的字符串仍按行重新存入字符串数组XX中。最后通过main()函数调用函数WriteDat()。把结果XX输出到文件out.dat中。
例:原文:Adb.Bcdza
abck.LLhj
结果:Aec.Bdeab
bcdl.LLik
原始数据文件存放的格式是。每行的宽度均小于80个字符.含标点符号和空格。
【试题程序】
#include
#include
char xxfi5031803 ;
int maxline=0l /*文章的总行数*/
int ReadDat(void);
void WriteDat(void);
void ConvertCharA(void)
{
}
void main()
{
if(ReadDat())f
printf(“数据文件IN.DAT不能打开
\n\007”);
return;
}
ConvertCharA();
WriteDat();
}
int ReadDat(void)
{
FILE*fp;
int i=0;
char*P;
if((fp=fopen(”in.dat”,”r”))==NULL)
return 1;
while(fgets(xx~i3.80,fp)!=NULL){
p=strchr(xx
\n,);
if(p)*p=0;
i++1
}
maxline=i;
fclose(fp);
return 0;
}
void WriteDat(void)
{
FILE*fp;
int i;
fp=fopen(“out.dat”。“W”);
for(i=0Ii
printf(“%s\n”,xx
);
fprintf(fp,“%s\n”,xx
);
}
fclose(fp);
}
选项
答案
void ConvertCharA(void) { int i,j; /*定义变量*/ for(i=0;i
=a,8L&xxEi]Ej]<=z) if(xx[i][j]==z)xx[i][j]=a; else xx[i][j]++; }
解析
转载请注明原文地址:https://jikaoti.com/ti/cv37FFFM
本试题收录于:
三级数据库技术题库NCRE全国计算机三级分类
0
三级数据库技术
NCRE全国计算机三级
相关试题推荐
对一个由n个关键码组成的序列,借助排序过程选出其中最大的关键码,要求关键码比较次数和移动次数最少,应当使用下列哪种排序方法?
若让元素1,2,3依次进栈,则出栈次序不可能出现哪一种情况?
对数据库系统的性能有两种主要的度量。第一种是【】,第二种是响应时间。
如果数据库中只包含成功事务提交的结果,此数据库状态就称为【】。
数据是信息的符号表示,或称载体;信息是数据的【】。
若事务T对数据R已加X锁,则其他事务对数据R
数据库的网状模型应满足的条件是
在数据库中,产生数据不一致的根本原因是
冯.诺伊曼结构的计算机有5大功能部件组成:运算器、控制器、【】、输入设备和输出没备。
结构化程序的基本控制结构有顺序、选择、【】。
随机试题
期权的买方支付权利金后,既承担很大风险,也拥有巨大的获利潜力。()
根据以下资料。回答以下问题。2013年末全国共有群众文化机构44260个,比上年末增加384个,其中乡镇文化站34343个,增加242个。年末群众文化机构从业人员164355人,比上年末增加8127人。群众文化机构实际使用房屋建筑面积3389.4
患者咳吐大量脓血痰2周后,身热渐退,咯吐脓血减少,胸胁隐痛,气短,自汗,盗汗,午后潮热,心烦口干,形体日渐消瘦,舌红苔薄,脉细数无力。其治疗主方是
患者咳嗽阵作半月,牵引胸胁作痛,咯痰黄稠带血,或咳鲜血,急躁易怒,大便秘结,小便短赤,舌质红,苔薄黄,脉弦数,此病的病机是( )。
A、溃疡孤立存在,表面微凹,少量黄色渗出物,周缘充血B、溃疡深达黏膜下,边缘高起,咽部及口角可见瘢痕C、溃疡大小、部位、深浅不一,与刺激物相适应D、溃疡较深,边缘不整,基底有浸润E、溃疡浅表,基底暗红色桑葚样肉芽肿,边缘鼠啮状轻型口疮的溃疡特点
在项目总说明中作出介绍的有()。
某旅游团结束了郊外的游览返回市内用餐,快到餐厅时,一位旅游者提出换餐,地陪应该()
桑代克的准备律与现代学习心理学中的()相一致。
确需复制军事秘密载体时,须经()同意。
全面建成小康社会,实现中华民族伟大复必,必须推动社会主义文化大发展、大繁荣,兴起社会主义文化建设新高潮,发挥文化引领风尚、教育人民、服务社会。推动发展的作用。坚持中国特色社会主义文化发展道路,发展社会主义先进文化的根本任务是
最新回复
(
0
)