首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #inc1ude<iostream> using namespace std; int main() { cout.fill(’*’); cout.width(6); cout.fill
有如下程序: #inc1ude<iostream> using namespace std; int main() { cout.fill(’*’); cout.width(6); cout.fill
admin
2019-05-06
11
问题
有如下程序:
#inc1ude<iostream>
using namespace std;
int main()
{
cout.fill(’*’);
cout.width(6);
cout.fill(’#’);
cout<<123<<end1;
retum 0;
}
执行后的输出结果是( )。
选项
A、##123
B、123##
C、***123
D、123***
答案
A
解析
此题考查的是I/O格式化输出。函数width(int n)设置输入输出宽度,当实际数据宽度小于制定的宽度时,多余的位置用填充字符填满;当实际数据宽度大于设置的宽度时,仍按实际宽度输出;函数fill(charc)用来设置填充字符。
转载请注明原文地址:https://jikaoti.com/ti/heA0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
若有如下程序:#include<iostream>usingnamespacestd;ints=0;classsample{staticintn;public:sample(int
C++中将两个字符串连接起来组成一个字符串的函数是______。
有以下程序:#include<iostream>usingnamespacestd;classTestClass{public:TestClass(intn){number=n;}//拷贝构造
有如下程序:#include<iostream>usingnamespacestd;classC1{public:~Cl(){cout<<1;}};classC2:publicC1{
重载的流运算符函数应该被定义为类的______函数。
算法的时间复杂度是指()。
______是一种特殊的成员函数,它主要用来为对象分配内存空间,对类的数据成员进行初始化并执行对象的其他内部管理操作。
对长度为n的线性表排序,在最坏情况下,比较次数不是n(n-1)/2的排序方法是
在最坏情况下,冒泡排序的时间复杂度为______。
随机试题
A.肝气横逆,胃失和降B.胃热阴虚,气火上逆C.胃虚有热,气逆不降D.胃虚痰阻,气逆不降旋覆代赭汤证的瘸机是
宗教可以推动行政组织的管理活动。()
紫癜的主要皮损是
脉冲场凝胶电泳时细胞的裂解液的主要成分为
为增强重镇安神作用,常与朱砂配伍的药物是
A.党参B.丹参C.北沙参D.南沙参E.拳参紫丹参的正名是()
关于正当防卫的论述,下列哪一选项是正确的?(2012年卷二7题)
下列中国公民中,依法可以投资设立个人独资企业的是()。
中共十八大以来,以习近平为主要代表的中国共产党人,顺应时代发展,从理论和实践结合上系统回答了新时代坚持和发展什么样的中国特色社会主义、怎样坚持和发展中围特色社会主义这个重大时代课题,创立了习近平新时代中国特色社会主义思想。习近平新时代中国特色社会主义思想是
Inthefollowingtext,somesentenceshavebeenremoved.ForQuestions1-5,choosethemostsuitableonefromthelistA-Gtofi
最新回复
(
0
)