更多"若下面程序运行时输出结果为
1,A,10.1
2,B,3.5"的相关试题:
[单项选择]如下程序运行时的输出结果是 #include<iostream> using namespace std; class ONE{ int c; public: ONE( ):c(0){eout<<1;} ONE(int n):C(n){cout<<2;} }; class TW0{ ONE onel; ONE one2; public: TWO(int m):one2(m){eout<<3;} }; int main( ){ TWO t(4); return 0; }
A. 3
B. 23
C. 123
D. 213
[单项选择]如下程序运行时的输出结果是
#include<iostream>
using namespace std;
class ONE
int c;
public:
ONE( ):c(0)eout<<1;
ONE(int n):C(n)cout<<2;
;
class TW0
ONE onel;
ONE one2;
public:
TWO(int m):one2(m)eout<<3;
;
int main( )
TWO t(4);
return 0;
A. 3
B. 23
C. 123
D. 213
[单项选择]如下程序段运行时的输出结果是
int i=4;int J=1;
int main( )
inti=8,j=i;
cout<<i<<j<<endl;
A. 44
B. 41
C. 88
D. 81
[填空题]下列程序运行时的输出结果是__【9】____。
#include<iostream>
using namespace std;
void Xfun(int&, int&);
int main( ){
int a=3, b=4;
Xfun(a, B) ;
cout<<a*a+b<<end1;
return 0;
}
void Xfun(int& x, int& y){
int z=x;
x=y; y=z;
}
[填空题]下列程序运行时的输出结果是___【8】___。
#include<iostream>
using namespace std;
int Xfun(int*a, int n);
int main( )
int b[6]={-2, 6, 8, -3, 5, 4);
cout<<Xfun(b, 6)<<end1;
return 0;
}
int Xfun(int*a, int n){
int x=0;
for(int*p=a; p<a+n; p++)if(*p>0)x+=*p;
return X;
}
[填空题]
下面程序运行时输出结果为
C:/Program Files is a directory.
请将程序补充完整。
import java.io.*;
public class DirTest {
public static void main(String[] args) {
File myDir = new File("C:/Program Files/");
System.out.println
(myDir+( 【11】 .isDirectory( )"is": "is not") +" a directory.");
}
}
[单项选择]下列程序运行时输出的结果是
Option Base 1
Private Sub Form_Click( )
Dim x (10)As Integer,y(5)As Integer
For i=1 to 10
x(i)=10-i+1
Next
For i=1 to 5
y(i)=x(2*i-1)+x(2*i)
Next
For i=1 to 5
Print y(i)
Next
End Sub
A. 3 7 11 45 19
B. 19 15 11 7 3
C. 1 3 5 7 9
D. 不确定的值
[单项选择]下列程序运行时输出的结果是( )。 Option Base 1 Private Sub Form_Click( ) Dimx(10)As Integer,y(5) As Integer ForI=1 to 10 x(i)=10-I+1 NextI ForI=1 to 5 y(i)cx(2*-1)+x(2*I) NextI ForI=1 to 5 Printy(i); NextI End Sub
A. 3 7 11 45 19
B. 17 13 9 5 1
C. 1 3 5 7 9
D. 不确定的值
[单项选择]下列程序运行时输出的结果是( )。
Private Sub Form_Click( )
Dim a
a=Array(“天天向上”,“清华大学”,“夭长地久”,“程序设计”)
For i=LBound(a,1) to UBound(a,1)
If Left(a(i),1)="天"Then Print a(i):
Next
End Sub
A. 天天向上
B. 天天向上天长地久
C. 出错信息
D. 天天向上清华大学天长地久程序设计
[填空题]
以下程序运行时输出结果是()。
#include
#include
int count(char s[])
{ int i=0;
if(s[i]==’/0’) return 0;
while(isalpha(s[i]))i++;
while(!isalpha(s[i])&&s[i]!=’/O’)i++;
return 1+count(&s[i]);
}
void main( )
{char line[]="one world,one dream.";
printf("%d",count(line));
}
[填空题]下面程序运行时输出结果为 【8】 。
#include<iostream.h>
#include<malloc.h>
class Rect
{
public:
Rect(int1,int w)(length=1;width=w;)
void Print( ){cout<<"Area:"<<length *width<<endl;)
void *operator new(size-t size){return malloc(size);}
void operator delete(void *p){free(p)
private:
int length,width;
};
void main( )
{
Rect*p;
p=new Rect(5,4);
p->Print( );
delete p;
}
[单项选择]下列程序在运行时输出的结果是()。Option Base 1Private Sub Form_Click( ) Dim x(10) For i=1 To 10x(i)=10-i+1Next i For i=10 To 1 Step-2Print x(i)Next i End Sub
A. 1 3 5 7 9
B. 9 7 5 3 1
C. 1 2 3 4 5 6 7 8 9 10
D. 10 9 8 7 6 5 4 3 2 1
[单项选择]下列程序运行时输出的结果是______。
Option Base 1
Private Sub Form_Click( )
Dim x(10) As Integer,y(5) As Integer
For i=1 to 10
x(i)=10-1+1
Next
For i=1 to 5
y(i)=x(2*i-1)+x(2*i)
Next
For i=1 to 5
Print y(i)
Next
End Sub
A. 3 7 11 45 19
B. 19 15 11 7 3
C. 13 5 79
D. 不确定的值
[填空题]
以下程序运行时输出结果是()。
#include
void change(int x,int Y,int *z)
{ int t;
t=x;x=y;y=*z;*z=t;
}
void main( )
{ int x=18,y=27,z=63;
change(x,y,&z);
printf("x=%d,y=%d,z=%d/n",x,y,z);
}
[填空题]
以下程序运行时输出结果是()
#include
void main( )
{double x[3]={1.1,2.2,3.3},Y;
FILE *fp=fopen("d://a.out","wb+");
fwrite(x,sizeof(double),3,fp)"
fseek(fp,2L*sizeof(double),SEEK_SET);
fread(&y,sizeof(double),1,fp)"
printf("%.1f",y);
fclose(fp)"
}
[填空题]以下程序运行时,输出到屏幕的结果是__(9)___
#include
#include
void f(char s[],char t[])
{
int i,m=strlen(t),k;
for(i=0;s[i]!=’/0’;i++)
if(s[i]>=’a’&& s[i]<=’z’)
{
k=t[i%m]-’0’;
s[i]=(s[i]-’a’+k)%26+’a’;
}
}
int main( )
{
char s1[10]="Be2013";
f(s1, "123");
puts(s1);
return 0;
}
[填空题]若下面程序运行时输出结果为
1,A,10.1
2,B,3.5
请将程序补充完整。
#include<iostream>
using namespace std;
int main( )
void test(int,char,double______);
test(1,’A’,10.1);
test(2,’B’);
return 0;
void test(int a,char b,doubleC) cout<<a<<’,’<<b<<’,’<<c<<endl;