以下语句中,输出结果与众不同的一个是()
第1题:
有如下4个语句:\n①cout~A~setfill(~*~)leftsetw(7)~B~endl;\n②coutsetfill(~*~)leftsetw(7)~A~~B~endl;\n③cout~A~serfill(~*~)rightsetw(7)~B~endl;\n④coutsetfill(~*~)rightsetw(7)~A~~B~endl;\n其中能显示A******B的是
A、①和③
B、①和④
C、②和③
D、②和④
第2题:
下面选项中,不属于C++语句的是( )。
A.{;}
B.cout<<"Hello!"<<endl
C.;
D.{int i=1;int f=i;cout<<f<<endl;}
第3题:
有如下4个语句:①cout~A~setfill(~*~)leftsetw(7)~B~endl;②coutsetfill(~*~)leftsetw(7)~A~~B~endl;③cout~A~serfill(~*~)rightsetw(7)~B~endl;④coutsetfill(~*~)rightsetw(7)~A~~B~endl;其中能显示A******B的是
A、①和③
B、①和④
C、②和③
D、②和④
第4题:
下列程序的输出结果是______。 #include<iostream> using namespace std; int main() { char a []="Hello, World"; char *ptr=a; while (* ptr) { if(*ptr)= 'a'&& *ptr' <= 'z') cout << char(*ptr+'A'-'a'); else cout << *ptr; ptr++; } return 0; }
A.HELLO,WORLD
B.Hello,World
C.hELLO, wORLD
D.hello,world
第5题:
下面程序的执行结果是【 】。
include<iostream>
include<iomanip>
using namespace std;
void main()
{
cout<<setfill('x')<<setw(10);
cout<<"Hello"<<endl;
}
第6题:
下列程序的输出结果为
#include<iostream.h>
void main( )
{
char * a[ ] ={"hello},"the"," world"};
char * * pa=a;
pa++;
cout < < * pa < < endl;
}
A.hello
B.the
C.world
D.hellotheworld
第7题:
与C语言 prinft("Hello word/n");语句功能相同的C++语句是( )。
A.cout>>"Hello world\n";
B.cin>>"Hello wofld\n;
C.cout<<"Hello world\n";
D.cin<<"Hello wofld\n;
第8题:
执行语句:cout<<setfill('*')<<setw(10)<<setfill('#')<<left<<123<<"OK"<<endl;后将输出
A.123*******OK
B.123#######OK
C.123********OK********
D.123#######OK########
第9题:
在C++语言中输出“Hello World”的语句是( )。
A.cout<<"Hello World";
B.cout>>"Hello World";
C.cin<<"Hello World";
D.cin>>"Hello World";
第10题:
下列语句中,输出与众不同的是
A.cout<<"1."<<setfill('')<<"Hello!"<<endl;
B.cout<<"1."<<''<<"Hello! \n";
C.cout<<"1. Hello!"<<endl;
D.cofit<<"1."<<setw(7)<<"Hello!";
第11题:
下列程序的输出结果是 #include <iostream> using namespace std; int main () { char a [] = "Hello,World": char*ptr = a; while (*ptr) { if(*ptr>= 'a' &&*ptr <='z' cout<<char{*ptr+'A'-'a'); else cout<<*ptr; ptr++; } return 0; }
A. HELLO. WORLD
B. Hello, World
C. hELLO, wORLD
D. hello, world
第12题:
cout<<1. <<setfill(’ ’)<< Hello! <<endl;
cout<<1.<<’ ’ <<Hello! /n;
cout<<1. Hello! <<endl;
cout<<1. <<setw(7)<< Hello! ;
第13题:
下面程序的执行结果是______。
include<iostream.h>
include<iomanip.h>
using namespace std;
void main()
{
cout<<setfill('x')<<setw(10);
cout<<"Hello"<<endl;
}
第14题:
下列程序的执行结果是______。
include<iostream.h>
include<iomanip.h>
using namespace std;
voidmain()
{
cout<<setfill('x')<<setw(10);
cout<<"Hello"<<end1;
}
第15题:
下列实现C语言语句printf("Hello!")的相同功能的语句是( )。
A.cout>>"Hello!"
B.cin>>"Hello!"
C.cout<<"Hello!"
D.cin<<"Hello!"
第16题:
A. cout<
B.cout<
C.cout<
D.cout<
第17题:
下列程序的输出结果为( )。 #include (iostream) using namespace std; void main( ) char,a[ ] = { "hello" ," the" ," world" }; char * * pa = a: pa + +; cout << * pa << ENDL; }
A.hello
B.the
C.world
D.hellotheworld
第18题:
下列语句中,输出与众不同的是
A.cout<<" 1. "<<setfill(' ') <<" Hello ! "<<end1
B.cout<<"1. "<<"<"Hello!"\n";
C.cout<<"1. Hello!"<<end1;
D.cout<<'1. "<<setw(7)<<"Hello! ";
第19题:
下列程序的输出结果为 #include<iostream.h> void main() { char*a[]={"hello","the","world"}; char**pa=a; pa++; cout<<*pa<<end1; }
A.hello
B.the
C.world
D.hello the world
第20题:
有如下4个语句: ①cout<<‘A’<<setfill(‘*’)<<1eft<<setw(7)<<‘B’<<endl; ②cout<<setrill(‘*’)((1eft<<setw(7)<<‘A’<<‘B’<<endl; ③cout<<‘A’<<serfill(‘*’)<<right<<setw(7)<<‘B’<<endl; ④cout<<setfill(‘x’)<<right<<setw(7)<<‘A’<<‘B’<<endl;
A.①和③
B.①和④
C.②和③
D.②和④ 其中能显示A* * * * * *B的是( )。
第21题:
有如下四个语句: ①cout<<A<<seifill(*)<<left<<setw(7)<<B<<endl; ②cout<<setfill(*)<<left<<setw(7)<<A<<B<<endl; ③cout<<A<<serfill(*)<<right<<setw(7)<<B<<endl; ④cout<<setfill(*)<<right<<setw(7)<<A<<B<<endl; 其中能显示A******B的是( )。
A.①和③
B.①和④
C.②和③
D.②和④
C。【解析】本题考查C++流的使用。setfill的作用是设置填充字符;left的作用是使输出数据在指定宽度内左对齐;right的作用是使输出数据在指定宽度内右对齐。
第22题:
设char str1[11]="HELLO,",str2[10]=“world”;则执行语句 cout<<strlen(strcpy(str1,str2)));后的输出结果是 ______。
A.12
B.11
C.7
D.5
第23题:
下列程序的执行结果为______。
include<iostream.h>
void main()
{
cout.fill(‘*’);
tout.width(10);
cout<<“hello”<<endl;
)