3,3
5,5
3,5
5,3
第1题:
有以下程序: #include<stdio.h> #include<string.h> #include void f(char*s,char*t) { char k; k=*s; *s=*t; *t=k; s++;t--; if(*s)f(s,t): } main() {char str[10]="abcdefg",*P; P=str+strlen(str)/2+1: f(p,p-2); printf("%s\n",str); } 程序运行后的输出结果是( )。
A.abcdefg
B.gfedcba
C.gbcdefa
D.abedcfg
第2题:
以下程序运行后的输出结果是【 】。
include<stdio.h>
main()
{ int k=1,s=0;
do{
if((k%2)!=0) continue;
s+=k; k++;
}while(k>10);
printf("s+%d\n",s);
}
第3题:
有以下程序:
include<iostream>
using namespace std;
class MyClass
{
public:
static int s;
MyClass();
void SetValue(int val);
};
int MyClass::s=0;
MyClass::MyClass()
{
S++;
}
void MyClass::SetValue(int val)
{
s=val;
}
int main()
{
MyClass my[3],*p;
p=my;
for(int k=0;k<3;k++)
{
p->SetValue(k+1);
p++;
}
cout<<MyClass::s<<end1;
return 0;
}
运行后的输出结果是______。
第4题:
下列程序的运行结果是( )。#include<stdio.h>void fun(int*s,int*p){ static int t=3; *p=s[t]; t--;}void main(){ int a[]={2,3,4,5),k; int x; for(k=0;k<4;k++) { fun(a,&x); printf("%d,",x); }}
A.5,4,3,2
B.2,3,4,5,
C.2,2,2,2,
D.5,5,5,5,
第5题:
以下程序的输出结果是【 】。
include <stdio.h>
define N 5
int fun(int *s,int a,int n)
{ int j;
*s=a j=n;
while(a!=s[j]) j-;
return j;
main()
{ int s[N+1]; int k:
for(k=1 ;k<=N;k++) s[k]=k+1:
print f("%d\n",fun(s,4,N));
}
第6题:
有以下程序:
include <iostream>
using namespace std;
const xnt N=5;
int fun(char *s,char a,int n)
{
int j;
*s=a;j=n;
while(a<s[j])
j--;
return j;
}
int main()
{
char s[N+1];
int k;
第7题:
下面程序的功能是输出数组s中最小元素,请填空。
include<iostream.h>
void main(){
int k, p, s[]={1,-9,7,2,-10,3};
k=s[0];
for(p=0;p<6;p++)
if(s[p]<k) 【 】;
cout<<k;
}
第8题:
请阅读以下程序: #include<stdio.h> #include<string.h> void fun(int b[]) { static int i=0; do {b[i]+=b[i+1]; }while(++i<2);} main() { int k,a[5]={1,3,5,4,9}; fun(A); for(k=0;k<5;k++)printf("%d",a[k]);} 上面程序的输出是( )。
A.13579
B.48579
C.48549
D.48999
第9题:
执行下列程序后,输出的结果是( )。 #include<stdio.h> #define S(X) X*X void main() { int a=9,k=3,m=2; a/=S(k+m)/S(k+m); printf("%d",a); }
A.1
B.4
C.9
D.0
第10题:
下列程序的运行结果是( )。
#include<stdio.h>
voidfun(int*s,int*p)
{ static int t=3;
*p=s[t];
t--;
}
void main()
{ int a[]={2,3,4,5},k;
int x;
for(k=0;k<4;k++)
{ fun(a,&x);
printf("%d,",x);
}
}
A.5,4,3,2
B.2,3,4,5,
C.2,2,2,2,
D.5,5,5,5,