首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include <iostream.h> #include <fstream.h> #include <stdlib.h> int main() { fstream filel,file2
有以下程序: #include <iostream.h> #include <fstream.h> #include <stdlib.h> int main() { fstream filel,file2
admin
2009-02-15
15
问题
有以下程序:
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
int main()
{
fstream filel,file2;
char line[100];
filel.open("source.txt",ios::in);
if(!file1)
{
cout<<"Can’t open file source.txt!"<<end1;
abort();
}
file2.open("dest.txt",ios::out);
if(!file2)
{
cout<<"Can’t open file dest.txt!"<<end1;
abort();
}
while(!file1.eof())
{
filel.getline(1ine,100);
file2<<line;
file2<<end1;
}
filel.close();
file2.close();
return 0;
}
此程序实现的功能是【 】。
选项
答案
将文本文件source.txt中内容复制到文本文件dest.txt中
解析
程序首先将两个文件source和dest都打开,然后通过while循环,以一行为单位进行内容的复制。
转载请注明原文地址:https://kaotiyun.com/show/Sdkp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
以下()不属于对象的基本特征。
请编写函数fun,对长度为7个字符的字符串,除首、尾字符外,将其余5个字符按ASCII码降序排列。例如,原来的字符串为CEAedca,排序后输出为CedcEAa。注意:部分源程序在文件PROGl.C中。请勿改动主函数main和
给定程序中已建立一个带有头结点的单向链表,链表中的各结点按结点数据域中的数据递增有序链接。函数fun的功能是:把形参X的值放入一个新结点并插入到链表中,插入后各结点数据域的值仍保持递增有序。请在程序的下划线处填入正确的内容并把下划线删除,使程序得
结构化程序设计中,下面对goto语句使用描述正确的是
若有以下程序#include<stdio.h>main(){FILE*fp;inti,a[6]={1,2,3,4,5,6},k;fp=fopen("data.da
已有定义inta=3;和输出语句printf("%8x",a);以下正确的叙述是()。
下列叙述中错误的是()。
数据库的数据模型分为
下列方法中,不属于软件调试方法的是()。
下面对对象概念描述正确的是
随机试题
以下不属于国际市场营销学与市场营销学的联系的是()
纤维蛋白原变成纤维蛋白,需要下列哪个凝血因子的参与
请简要陈述明代中央司法机关体制。
下列各项中,属于自制原始凭证的有()。
银行承兑汇票到期,承兑申请人未能足额交存票款,对尚未扣回的承兑金额按每天()收罚息。
某设备的年收益额为10万元.适用本金化率为10%,则该设备的评估价值为()万元。
下列各项资产中,不会根据账面价值与可收回金额确定减值的有()。
下列说法中,符合精神分析理论关于心理动力观点的包括()。(2010年11月真题)
Childrenhavetheirown【C1】______inplayinggames.Theyseldomneeda【C2】______and【C3】______troubletokeepscore.Theydon’tca
WhatdidMrsThriscottdoafterlivingaloneonthetopfloorofanoldhouseformanyyears?Sheasked____________________
最新回复
(
0
)