搜题
网友您好,请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
提问人:网友kingylh 发布时间:2022-01-06
[主观题]

有下列程序段:#include <iostream>using namespace std;int main() { char b[]= "Hello,you"; b[

有下列程序段: #include <iostream> using namespace std; int main() { char b[] = "Hello,you"; b[5] = 0; cout<<b<<end1; return 0; } 执行此程序后,得到的输出结果是()。

A.Hello,you

B.Hello0you

C.Hello

D.0

简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
查看官方参考答案
更多“有下列程序段:#include <iostream>using namespace std;int main() { char b[]= "Hello,you"; b[”相关的问题
第1题
有以下程序:#include<iostream.h>#include<iomanip.h>void main(){cout.fill('*');cout.width(10

有以下程序: #include<iostream.h> #include<iomanip.h> void main() { cout.fill('*'); cout.width(10); cout,<setiosflags(ios::left)<<123.45<<endl; } 程序执行后的输出结果是()

A.****123.45

B.**123.45**

C.123.45****

D.***123.45*

点击查看答案
第2题
有以下程序: include<iostream.h> include<fstream.h> include<stdlib.h> intmain() {fstreamfil

有以下程序:

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;

}

此程序实现的功能是【 】。

点击查看答案
第3题
写出下列程序的运行结果【】。include <iostream.h>.include <fstream.h>include <stdlib.h>void ma

写出下列程序的运行结果【 】。

include <iostream.h>.

include <fstream.h>

include <stdlib.h>

void main()

{

fstream outfile, infile;

outfile.open("data.clat", ios:: out);

if(!outfile)

{

cout<<"Can't open the file."<<end1;

abort();

}

outfile<<" 1234567890"<<end1;

outfile<<"aaaaaaaaa"<<end1;

outfile<<"**********"<<end1;

outfile.close();

infile.open("data. dat ", ios:: in);

if(!infile)

{

cout<<"Can't open the file."<<end1;

abort();

}

char line[80];

int I=0;

while(!infile. eof())

{

I++;

infile.getline(line, sizeof(line));

cout<<I<<":"<<line<<end1;

}

infile.close();

}

点击查看答案
第4题
假设文本文件letters.txt中已经存有“1234567890”十个...

假设文本文件letters.txt中已经存有“1234567890”十个字符,则下列程序的运行结果是 。 #include <fstream.h> #include <stdlib.h> void main(void) { fstream file("nums.txt",ios::in); char ch; if (!file) exit(0); file.seekg (1L, ios::beg); file.get(ch); cout << ch << endl; file.seekg (-5L, ios::end); file.get(ch); cout << ch << endl; file.seekg (-2L, ios::cur); file.get(ch); cout << ch << endl; file.close(); }

点击查看答案
第5题
简要叙述下列程序代码,并判断如下程序的功能: #includ...

简要叙述下列程序代码,并判断如下程序的功能: #include <fstream> #include <iostream> using namespace std; int main(int argc, char* argv[]) { char c; fstream fio(argv[1], ios::in | ios::out); if (fio.fail()) //打开文件成功与否监控 { cerr << "Cannot open file:" << argv[1] << endl; return 1; } while((c=fio.get())!=EOF) //判断是否到达文件末尾 if (isupper(c)) { fio.seekg(-1, ios::cur); fio.put(tolower(c)); } fio.close(); return 0; }

点击查看答案
第6题
文本文件letters.txt中已经存有“abcdefg”七个字符,则...

文本文件letters.txt中已经存有“abcdefg”七个字符,则下列程序的运行结果是 。 #include <fstream.h> #include <stdlib.h> void main(void) { fstream file("letters.txt",ios::in); char ch; if (!file) exit(0); file.seekg (2L, ios::beg); file.get(ch); cout << ch ; file.seekg (-3L, ios::end); file.get(ch); cout << ch ; file.seekg (1L, ios::cur); file.get(ch); cout << ch << endl; file.close(); }

点击查看答案
第7题
有下列程序段:#include <iostream>using namespace std;int main()

A.Hello,you

B.Hello0you

C.Hello

D.0

点击查看答案
第8题
下列程序用于将源文件中的字母进行大小写转换,while的条件是【 】。include<iostream. h>include<fs

下列程序用于将源文件中的字母进行大小写转换,while的条件是【 】。

include<iostream. h>

include<fstream. h>

include<iomanip. h>

void main()

}

char ch;

fstream filel, file2

char fn1[10], fn2[10];

cout<<"输入源文件名:";

cin>>fn1

cout<<"输入目标文件名:";

tin>>fn2

file1, open(fn1 ,ios: :in);

file2, open(fn2, ios:: out);

while(________)

{

if(ch>='a'&&ch<='z')

ch=ch-'a'+'A',

file2, put(ch),

}

file1, close(),

file2, close();

}

点击查看答案
第9题
有以下程序:include<iostream>include<fstream>using namespace std;int main(){fstream file;fi

有以下程序:

include<iostream>

include<fstream>

using namespace std;

int main()

{

fstream file;

file.open("abc.txt", ios :: in);

if (!file )

{

cout<<"Can not open abc.txt"<<end1;

abort();

}

char buf[ 80 ];

int i = 0;

while (!file.eof())

{

file.getline(buf,80);

i++;

}

cout<<"Lines :"<<i<<end1;

file.close();

return 0;

}

程序实现的功能是【 】。

点击查看答案
第10题
阅读以下程序 #include<fstream.h> void main() { ifstream infile; ofstream outfile; fstream

阅读以下程序

#include<fstream.h>

void main()

{

ifstream infile;

ofstream outfile;

fstream iofile;

iofile.open("a.txt",ios::in);

iofile.close();

iofile.open("b.txt",ios::out);

}

下列描述错误的是

A.对象infile只能用于文件输入操作

B.对象outfile只能用于文件输出操作

C.对象iofile在文件关闭后,不能再打开另一个文件

D.对象iofile可以打开一个文件同时进行输入和输出

点击查看答案
第11题
下列程序完成从文件读取文件显示的同时写入第二个文件,则在程序中划线部分应该出现的语句是_____
_。

include<iostream.h>

include(fstream.h)

void main()

{

fstream filel,file2;

charfnl[10],fn2[10],ch;

cout<<“输入源文件名”;

cin>>fnl;

cout<<“输入目标文件名”;

cin>>fn2;

filel.open(fnl,ios::i

点击查看答案
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

- 微信扫码关注简答题 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注简答题 -
请用微信扫码测试
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

简答题
下载APP
关注公众号
TOP