若运行时给变量x输入12,则以下程序的运行结果是 #include <iostream.h> void main() { int x,y; cin>>x; y=x>12? x+10:x-12; cout<<y; cout<<endl; }
A.0
B.22
C.12
D.10
第1题:
若运行时给变量x输入12,则以下程序的运行结果是
main()
{int x,y;
scanf("%d",&x);
y=x>12?x+10:x-12;
printf("%d\n",y);
}
A.0
B.22
C.12
D.10
第2题:
假如输入为30和60,下列程序运行的结果是【 】。
include<iostream.h>
void main() {
int a, b;
cin>>a>>b;
if(a<b) {
a=a+b;
b=a-b;
a=a-b;
}
cout<<a<<“,”<<b<<endl
}
第3题:
以下程序的执行结果是______。
include<iostream.h>
void main()
{
int x=5 y=2;
cout<<! (y==x/2)<<",";
cout<<(y!=x%3)<<",";
cout<<(x>0 && y<0=<<",";
cout<<(x!=y||x>=y)<<endl;
}
第4题:
下面程序的运行结果是______。
include<iostream.h>
void fun(int &a,int b=3)
{
static int i=2;
a=a+b+i;
i=i+a;
}
void main()
{
int x=5,y=2;
fun(x,y);
cout<<x<<",";
fun(x);
cout<<x<<endl;
}
第5题:
以下程序的运行结果是 #include<iostream.h> void sub(int x,int y,int *z) { *z=y-x;} void main( ) { int a,b,c; sub(10,5,&a) ; sub(7,a,&b) ; sub(a,b,&c) ; cout << a <<","<< b <<"," << c << en
A.5,2,3
B.-5,-12,-7
C.-5,-12,-17
D.5,-2,-7
第6题:
有以下程序: #include<iostream.h> Float fun(int x, int y) { return(x+y) ;} void main( ) { int a=2,b=5,c=8; cout < < fun((int) fun(a+c, b) ,a-c) ;} 程序运行后的输出结果是
A.编译出错
B.9
C.21
D.9.0
第7题:
以下程序的执行结果是 ______。
include<iostream.h>
int &max(int &x,int &y)
{
return(x>y? x:y);
}
void main()
{
int n=2,m=10;
max(n,m)--;
cout<<"n="<<n<<",m="<<m<<endl;
}
第8题:
有以下程序main(){ int x,y; scanf("%d",&x); y=x>12?x+10:x-12; printf("%d\n",y);}若运行时给变量x输入12,则以下程序的运行结果是A.0 B.22C.12 D.10
第9题:
若运行时给变量x输入12,则以下程序的运行结果是 main() { int x,y; scanf("%d",&x); y=x>12? x+10:x-12; printf("%d\n",y);}
A.0
B.22
C.12
D.10
第10题:
下列程序运行后的输出结果是( )。 #include<iostream.h> void fun(int,int,int*); void main() { int x,y,z; fun(5,6,&x); fun(7,x,&y); fun(x,y,&z); cout<<x<<","<<y<<","<<z<<end1; } void fun(int a,int b,int *c) { b+=a; *c=b-a; }
A.5, 5, 5
B.6, 6, 6
C.5, 6, 7
D.7, 7, 7
第11题:
若运行时给变量x赋值12,则以下程序的运行结果是( )。 #include<stdio.h> main() { int x,y; scanf("%d",&x); y=x>12? x+10:x-12; printf("%d\n",y); }
A.0
B.22
C.12
D.10
第12题:
若运行时给变量x输入12,则以下程序的运行结果是 #include<iostream.h> void main( ) { int x,y; cin>>x; y=x>12? x+l0:x-12; cout<<y; cout<<endl; }
A.0
B.22
C.12
D.10
第13题:
阅读以下程序
#include<iostream.h>
void main( )
{
char line[10];
cin>>line;
cout<<line<<endl;
}
如运行时输入This is example.<CR>,则程序的输出结果是
A.This
B.This is
C.This is a
D.This is an example.
第14题:
以下程序运行后的输出结果是【 】。
include<iostream.h>
void fun(int x,int y)
{ x=x+y;y=x-y;x=x-y;
cout<< x << "," <<y << " ,";}
void main( )
{ int x=2,y=3;fun(x,y);
cout<< x << "," << y << endl;}
第15题:
以下程序的运行结果是( )。 #include<iostream.h> void sub(int x,int y,int*z) {*Z=y-x;} void main() {int a,b,c; sub(10,5,&a); sub(7,a,&b); sub(a,b,&c); cout<<a<<“,”<<b<<“,”<<c<<endl;}
A.5,2,3
B.-5,-12,-7
C.-5,-12,-17
D.5,-2,-7
第16题:
下面程序的运行结果为_____。
include<iostream.h>
void fun(int x=0,int y=0)
{
cout < < x < < y;
}
void main( )
{
fun(5) ;
}
第17题:
若运行时给变量x输入12,则以下程序的运行结果是 #include<iostream.h> void main( ) { int x,y; cin > > x; y=x > 12? x+lO:x-12; cout < < y; cout < < end1; }
A.0
B.22
C.12
D.10
第18题:
以下程序输出结果是 ______。 #include<iostream.h> void fun(int x,int y,int z){z=x+y;} void main() { int a=10; fun (2,2,a); cout<<a; }
A.0
B.4
C.10
D.无定值
第19题:
若运行时给变量x输入12,则以下程序的运行结果是 【 】 ;
main(){
int x,y;
scanf(""%d"",&x);
y=x>12?x+10:x-12;
printf(""%d\n"",y);
}
第20题:
若从键盘输入70,则以下程序输出的结果是【 】。
include<iostream.h>
void main()
{
int a; cin>>a;
if(a>50) cout<<a;
if(a>40) cout<<a;
if(a>30) cout<<a;
}
第21题:
若运行时给变量x输入12,则以下程序的运行结果是 #include<iostream.h> void main() { int x,y; cin>>x; y=X>12?x+10:x-12; cout<<y; cout<<endl; }
A.0
B.22
C.12
D.10
第22题:
下列程序段的输出结果是 #include<iostream.h> void fun(int * X,int * y) { cout < < * X < < * y; * X=3; * y=4; } void main( ) { int x=1,y=2; fun(&y,&x); cout < < X < < y < < end1; }
A.2143
B.1212
C.1234
D.2112
第23题:
有以下程序 #include<iostream.h> floatfun(int x,int y) {return(x+y);} void main() {int a=2,b=5,c=8; tout<<fun((int)fun(a+c,b),a-C);} 程序运行后的输出结果是
A.编译出错
B.9
C.21
D.9