- 1、本文档共20页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
c教材第12章习题解答(何应钦)(C textbook twelfth chapter exercises answers (He Yingqin))
c教材第12章习题解答(何应钦)(C textbook twelfth chapter exercises answers (He Yingqin))
p
1.
# include stdio.h
# include stdlib.h
void main ()
{
file * fp;
char c;
int facilitates = 0, digit = 0, other = 0;
if ((fp = fopen (d: \ \ d12z-1.txt, r)) = = null)
{
printf (file open error! \ n );
exit (0);
}
c = fgetc (fp);
while (c! = eof)
{
if ((c = a c = z) | | (c = a c = z) facilitates + +;
else if (c = 0 c = 9) digit + +;
else if (c = = \ n);
else other + +;
printf (% c, (c);
c = fgetc (fp);
}
if (fclose (fp))
{
printf (can not close the file. \ n );
exit (0);
}
printf (\ n该文件字母有% d 个, 数字有% d 个, 其他字符有% d 个 \ n, letter, digit, other);
}
-----------------------------------
2.
# include stdio.h
# include stdlib.h
void main ()
{
file * fp;
float x;
if ((fp = fopen (d: \ \ d12z-2.txt, w)) = = null)
{
printf (file open error! \ n );
exit (0);
}
printf (请输入一个实数 (以 - 1结束输入):);
scanf (% f, x);
while (x! = - 1)
{
fprintf (fp, % f n x);
printf (请输入一个实数 (以 - 1结束输入):);
scanf (% f, x);
}
if (fclose (fp))
{
printf (can not close the file. \ n );
exit (0);
}
}
-----------------------------------
3.
# include stdio.h
# include stdlib.h
void main ()
{
file * fp1, * fp2;
int i = 1, j = 1;
char c1, c2;
if ((fp1 = fopen (d: \ \ d12z-3-1.txt, r)) = = null)
{
printf (file open error! \ n );
exit (0);
}
if ((fp2 = fopen (d: \ \ d12z-3-2.txt, r)) = = null)
{
printf (file open error! \ n );
exit (0);
}
c1 = fgetc (fp1);
c2 = fgetc (fp2);
while (c1! = eof c! = eof)
{
if (c1! = c2)
break;
else if (c1! = \ n)
{
j + +;
c1 = fgetc (fp1);
c2 = fgetc (fp2);
}
else
{
in + +;
j = 1;
c1 = fgetc (fp1);
c2 = fgetc (fp2);
}
}
printf (首次不同的字符在第% d% d 行、第 列. \ n, i, j);
if (fclose (fp1))
{
printf (can not close the file. \ n );
exit (0);
}
if (fclose (fp2))
{
printf (can not close the file. \ n );
exit (0);
}
}
-----------------------------------
4.
# include stdio.h
# include stdlib.h
# include string.h
all f (char * p1)
{
char * p;
p = strstr (p1, for);
if (p = = null) return 0;
else
您可能关注的文档
- 88天gmat 800分——gmat备考经验(88 days GMAT 800 points - GMAT pro forma experience).doc
- 8教学实践(8 teaching practice).doc
- 8机械能守恒定律().doc
- 87-第六章 外汇与国际收支(87- sixth chapter, foreign exchange and international payments).doc
- 8级粤语考试题(8 level Cantonese examination questions).doc
- 8组最易搞混的英语近义词辨析(Analysis of the most confusing synonyms in the 8 groups).doc
- 8计算机(8 computer).doc
- 9 骆驼和羊 教学目的要求(9 teaching requirements for camels and sheep).doc
- 9.4《机械效率》说课稿(9.4, mechanical efficiency lesson draft).doc
- 90后时代,要变通企业文化(After 90 times, it is necessary to flexible corporate culture).doc
- c盘和qq里的每个文件夹都是干什么用的(Each folder C and QQ is used for what).doc
- c盘文件不可以乱删(C files can not be confused).doc
- c盘的文件什么可以删什么不可以删(What C file can delete what can not delete).doc
- c语言 入门知识 习题演练(Introduction to C language exercises exercises).doc
- c盘里那些能删那些不能删(C who can delete those cannot be deleted).doc
- c语言 itoa函数及atoi函数(C language, Itoa function and ATOI function).doc
- c语言 第一次(C language for the first time).doc
- c语言 第一章(C language Chapter 1).doc
- c语言 简单管理系统(C language simple management system).doc
- c语言-课后题答案(C language - after-school questions answer).doc
文档评论(0)