首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #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
2016-11-23
20
问题
有如下程序:
#inc1ude<iostream>
using namespace.std;
int main()
{
cout.fill(’*’);
cout.width(6);
cout.fill(’#’);
cout<<123<<end1;
retum 0;
}
执行后的输出结果是( )。
选项
A、###l23
B、123###
C、***l23
D、123***
答案
A
解析
此题考查的是I/O格式化输出。函数width(int n)设置输入输出宽度,当实际数据宽度小于制定的宽度时,多余的位置用填充字符填满:当实际数据宽度大于设置的宽度时,仍按实际宽度输出:函数fill(char c)用来设置填充字符。
转载请注明原文地址:https://kaotiyun.com/show/VsAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
设有以下程序:#include<iostream>usingnamespacestd;intmain(){inta,b,k:4,m=6,*p1=&k,*p2=&m;a=p1==&m;
有以下程序:#include〈iostream〉usingnamespacestd;#defineM10#defineB4voidsetstar(char*a,intn){
设有数组定义:chararray[]="China";,则数组array所占的空间为
已知有定义constintD=5;inti=1;doublef=0.32;charc=15;则下列选项错误的是
执行语句序列ofstreamoutfile("data.dat");if(…)cout<<"ok";elsecout<<"fail";后,如果文件打开成功,显示“ok”,否则显示“fail”。由此可知,上面if语句的“…”
下列函数中,()是对文件进行写操作的。
在数据管理技术发展过程中,文件系统与数据库系统的主要区别是数据库系统具有
随机试题
风热感冒取大椎、曲池、合谷、外关等穴浅刺疾出以清热解表的针灸治疗原则是
“肾为气之根”主要指
引起急性梗阻性化脓性胆管炎最常见的因素是
在可摘局部义齿支架弯制中,属于无卡环体,环抱稳定作用较差的卡环是A.锻丝下返卡环B.锻丝上返卡环C.长臂卡环D.固定卡环E.连续卡环
下列药物中,善于疏解半表半里之邪又有和解退热之功的是()。
A.鸡血藤B.丹参C.益母草D.桃仁E.莪术治疗血瘀而兼便秘,宜用
教育心理学研究认为,焦虑水平与学习效率之间的关系是______。
《华阳国志》
以经理办公室的名义,按一定的格式和要求,写一份于2012年7月28日公布的通知,包括以下内容:1.时间:8月7日星期四下午2:002.会议地点:公司办公大楼会议厅3.会议内容:讨论能源规划(energyprogram)
Studiesoffriendshipseemtoimplicatemorecomplexfactors.Forexample,onefunctionfriend-shipseemstofulfillis【C1】____
最新回复
(
0
)