首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
以下程序中用户由键盘输入一个文件名,然后输入一串字符(用$结束输入)存放到此文件中,形成文本文件,并将字符的个数写到文件尾部。请填空。 #include <string.h> main() { FILE*fp: char ch
以下程序中用户由键盘输入一个文件名,然后输入一串字符(用$结束输入)存放到此文件中,形成文本文件,并将字符的个数写到文件尾部。请填空。 #include <string.h> main() { FILE*fp: char ch
admin
2010-02-13
15
问题
以下程序中用户由键盘输入一个文件名,然后输入一串字符(用$结束输入)存放到此文件中,形成文本文件,并将字符的个数写到文件尾部。请填空。
#include <string.h>
main()
{ FILE*fp:
char ch,fname[32] int count=0:
prinft("input the filename:"): scanf("%s",fname);
if((fp=fopen(______,"w+"))==NULL)
{ printf("can’t open file:%s\n",fname);
exit(0):
}
printf("enter data:\n"):
while((ch=getchar())!=’$’)
{fputc(ch,fp): count++; }
fprintf(______,"\n%d\n", count);
fclose(fp):
}
选项
答案
fname, fp
解析
转载请注明原文地址:https://kaotiyun.com/show/iJWp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列叙述中正确的是
以下叙述中错误的是
窗体上有名称为Command1的命令按钮,名称分别为Label1、Label2、Label3的标签。编写如下程序:PrivatexAsIntegerPrivateSubCommand1_Click()Staticy
下列链表中,其逻辑结构属于非线性结构的是()。
在窗体上画一个名称为Commandl的命令按钮,再画两个名称分别为Label1、Label2的标签,然后编写如下程序代码:PrivateXAsIntegerPrivateSubCommandl_Click()X=5:Y=3
设窗体文件中有下面的事件过程:PrivateSubCommandl__Click()Dimsa%=100PrintaEndSub其中变量a和s的数据类型分别是
以下自定义数据类型的语句中,正确的是
下列关于算法的描述中错误的是
随机试题
十进制数字10的BCD码为()。
处于局部受压的砌体,其抗压强度提高是因为:
垃圾填埋场的使用期限较长,达_______年以上。()
财务净现值是评价技术方案盈利能力的()。
在考虑影响公司股价变动的因素时,对于公司经营中的财务状况,常用来衡量其盈利性的指标有()。①每股收益②净资产收益率③杠杆比率④流动比率
(2018年)甲公司的主营业务是生产、销售体育运动器材,从去年起,该公司在保留原有业务的同时寻找新的市场机会,开发出适合个人使用的运动健康补测仪并尝试性投放市场,该仪器可随时把使用者在运动中的有关生物指数显示并记录下来,从而帮助使用者了解自己的健康状况并选
从所给的四个选项中,选择最合适的一个填入问号处,使之呈现一定的规律性。()
体育与健康课程的教学()体现在学生体育与健康知识的掌握、运动技能的习得、体能的增强和学习行为的变化等方面。
领导让你负责一项工作。并安排了一位老同志协助你。但是在工作中大家只服从老同志的安排。你怎么办?
()是国际货币基金组织创造的具有“纸黄金”之称的记账形式,用以充当国际间的支付手段。
最新回复
(
0
)