6
5
4
3
第1题:
如下程序的输出结果是______。
include<iostream>
using namespace std;
int funl(int x){return++x;}
int fun2(int&x){return++x;}
int main( ){
int x:1,y=2;
Y=funl(fun2(x));
cout<<x<<','<<y;
return 0;
}
第2题:
有以下程序: #include <stdio.h> fun(int a, int b) { if(a>b) return(a); else return(b); } main() { int x=3,y=8,z=6,r; r=fun(fun(x,y),2*z); printf("%d\n",r); } 程序运行后的输出结果是( )。
A.3
B.6
C.8
D.12
第3题:
以下程序的输出结果是______。
include<iostream.h>
int add(int x, int y)
{
return x+y;
}
double add(double x, double y)
{
return x+y;
}
void main()
{
int a=3, b=3;
double c=6.5, d=1.5;
cout<<add(a, b)<<","<<add(c, d)<<end1;
}
第4题:
有以下程序: #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
第5题:
以下程序执行后的输出结果是( )。 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = X*X; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第6题:
现有如下程序段
#include "stdio.h"
int aa(int x,int y);
main()
{int a=24,b=16,c;
c=aa(a,b);
printf("%d\n",c);}
int aa(int x,int y)
{int w;
while(y)
{w=x%y;
x=y;
y=w;}
return x;}
则程序段的输出结果是
A.8
B.7
C.6
D.5
第7题:
若有以下程序:
include <iostream>
using namespace std;
int f(int x, int y)
{
return (y-x)*x;
}
int main()
{
int a=3,b=4,c=5,d;
d=f(f(a,b) ,f(a,c) );
cout<<d<<<end1;
return 0;
}
执行后的输出结果是【 】。
第8题:
有以下程序: #include<stdio.h> int f(int x) {int y; if(x==0||x==1)return(3); y=x*x-f(x-2); return y; } main() {int z; z=f(3);printf("%d\n",z); } 程序的运行结果是( )。
A.0
B.9
C.6
D.8
第9题:
分析以下程序执行结果【 】。
include<iostream.h>
int f (int x, int y){
return x,y;
}
double f (double x, double y) {
return x,y;
}
void main() {
int a=4, b=6;
double c=2.6, d=7.4;
cout<<f (a, b) <<","<<f (c, d) <<end1;
}
第10题:
请将以下程序中的函数声明语补充完整。
include<stdio.h>
int【 】
main()
{ int x,y,(*p)();
sccanf("%d%d",&x,&y);
p=max;
printf(%d\n",(*p)(x,y));
}
int max(int a,int b)
{return(a>b?a:b);}