当前位置:首页 > 高级语言程序设计(一)(00342) > 正文内容

阅读下列程序,写出程序运行的输出结果。
假定在当前盘当前目录下有2个文本文件,其名称和内容如下:
文件名a1.txta2.txt
内容121314#252627#
#include
#include
voidfc(FILE*fpl)
{charc;
while((c=fgetc(f01))!='#')putchar(C);/*输出非'#'字符*/
}
voidmain()
高老师2年前 (2024-03-26)高级语言程序设计(一)(00342)9

阅读下列程序,写出程序运行的输出结果。
假定在当前盘当前目录下有2个文本文件,其名称和内容如下:
文件名a1.txta2.txt
内容121314#252627#
#include
#include
voidfc(FILE*fpl)
{charc;
while((c=fgetc(f01))!='#')putchar(C);/*输出非'#'字符*/
}
voidmain()
{FILE*fp;
if((fp=fopen("a1.txt","r"))==NULL)
{printf("Cannotopenfile!\n");exit(0);}
else{fc(fp);fclose(fp);}
if((fp=tbpen("a2.txt","r",))==NULL)
{printf("Cannotopenfile!\n");exit(0);}
else{fc(fp);fclose(fp);}
}

输出结果:121314252627

扫描二维码免费使用微信小程序搜题/刷题/查看解析。

版权声明:本文由翰林刷题小程序授权发布,如需转载请注明出处。

本文链接:https://doc.20230611.cn/post/442085.html

分享给朋友: