更多"[单选题]以下程序的输出结果是( )。#include <ios"的相关试题:
[单选题]以下程序的输出结果是( )。
#include
Using namespace std;
Int main()
{
int n=1;
while (n++<4);
cout << n << endl;
return 0;
}
A. 1
B. 5
C. 6
D. 4
[单选题]以下程序运行后输出结果是( )
#include
Using namespace std;
Int
A,b;
Void f()
{ int x=20,y=25;
a=a+x+y;
b=b+x-y;
}
Int main()
{ int x=9,y=7;
a=x+y;b=x-y;
f();
cout << a << "," << b << endl;
return 0;
}
A. 61,-3
B. 16,2
C. 25,-5
D. 以上都不正确
[单选题]以下程序的运行结果是( )。
#include
Using namespace std;
Int main()
{
int x=1;
switch(x)
{ case 1:++x;
case 0:--x;
default: x+=7;
}
cout << x << endl;
return 0;
}
A. 2
B. 1
C. 7
D. 8
[单选题]有以下程序
#include
Using namespace std;
Int main(){
int a;
cin >> a;
if(a++<9) cout << a;
else cout << a--;
return 0;
}
程序运行时从键盘输入9 回车,则输出结果是( )。
A. 10
B. 11
C. 9
D. 8
[单选题]下列程序的运行结果是:( )
#include
using namespace std;
int main()
{
int a=2;
int b=a+1;
cout<A.0.66667
B.0
C.0.7
D.0.6666666…
[单选题]执行下列程序语句后,屏幕输出为( )。
#includeUsing namespace std;
Int n=5;
Int main()
{
int n=3;
n++;
::n++;
cout< return0;
}
A. 3
B. 4
C. 5
D. 6
[简答题]以下程序的运行结果为 )。
#include
Using namespace std;
Int a{5};
Int main()
{
{
int a{2};
cout << ::a;
cout << a;
}
cout << a << endl;
return 0;
}
[单选题]
执行以下语句输出的结果是( )
i=0
while i<5:
i+=1
if i==4:
continue
else:
print(i)
A.
0,1,2,3,4
B.
1,2,3,4,5
C.
0,1,2,3
D.
1,2,3,5
[单选题]
执行以下语句输出的结果是( )
a=True
b=False
if a or b and a:
print('yes')
else:
print('no')
A.
yes
B.
no
C.
True
D.
False
[填空题]以下程序的输出结果是__()____。
#include
Using namespace std;
Int main(
{
int s,i;
for ( s=0,i=1; i<4; i++,s+=i );
cout << s << endl;
return 0;
}
[单选题]以下程序输出结果是 。
#include "stdio.h"
void f ();
main()
{int a;
for(a=1;a<=3;a++)
fun();
}
void fun()
{static int i=1;
i+=3;
printf("%2d",i);
}
A.4 7 10
B.4 4 4
C.4 5 6
D.4 6 8
[单选题]有如下程序:
#include
using namespace std;
class Base{
protected:
Base(){cout<<'A';}
Base(char c){cout<A.B
B.BA
C.AB
D.BB
[单选题]有如下程序:
#include
Using namespace std;
Void function2(int n);
Void function1(int n){
if(n<=0) return;
function2(n-2);
}
Void function2(int n){
if(n<=0) return;
function1(n-1);
}
Int main){
function1(5);
return 0;
}
下列关于程序运行情况的描述中,正确的是( )。
A. function1运行1次,function2运行2次
B. function1运行2次,function2运行1次
C. function1运行2次,function2运行3次
D. function1运行2次,function2运行2次
[单选题]执行下列程序时输入123<空格>456<空格>789<回车> 输出结果是 ()。
main()
{ char s[100]; int c, i;
scanf("%c",&c); scanf("%d",&i); scanf("%s",s);
printf("%c,%d,%s\n",c,i,s);
}
A.123456789
B.1456789
C.1,23,456,789
D.1,23,456