更多"以下程序运行后的输出结果是() #include<stdio.h> "的相关试题:
[填空题]
以下程序中给指针p分配三个double型动态内存单元,请填空。
# include <stdlib.h>
main ( )
{ double *p;
p=(double *) malloc( 【18】 );
p[0]=1.5;p[1]=2.5;p[2]=3.5;
printf(“%f%f%f/n”,p[0],p[1],p[2]);
}
[单项选择]以下程序在VC6平台上编译运行,程序运行后的输出结果是
#include<stdio.h>
main( )
int s, t, A=10; double B=6;
s=sizeof(A); f=sizeof(B);
printf("%d, %d/n", s, t);
A. 2,4
B. 4,4
C. 4,8
D. 10,6
[单项选择]以下程序运行后,消息框的输出结果是( )。
OPTION BASE 1
PRIVATE SUB COMMAND1_CLICK( )
DIM A(10) , P(3) AS INTEGER
K=5
FOR I=1 TO 10
A(I) = I
NEXT I
FOR I=1 TO 3
P(I)=A(I*I)
NEXT I
FOR I=1 TO 3
K=K+P(I) ~ 2
NEXT I
MSGBOX K
END SUB
A. 33
B. 28
C. 35
D. 37
[填空题]以下程序运行后输出结果是 【7】 。
#include
main( )
{ int a=37;
a%=9; printf("%d/n",a);
}
[填空题]以下程序运行后输出结果是 【8】 。
#include
main( )
{ int i, j;
for(i=6;i>3;i--) j=i;
printf("%d%d/n",i,j);
}
[填空题]以下程序运行后输出结果是 【9】 。
#include
main( )
{ int i,n[]={0,0,0,0,0};
for(i=1;i<=2;i++)
{ n[i]=n[i-1]*3+1;
printf("%d ",n[i]);
}
printf("/n");
}
[填空题]以下程序运行后输出结果是 【11】 。
#include
void fun(int x)
{ if(x/5>0) fun(x/5);
printf("/%dn",x);
}
main( )
{ fun(11); printf("/n"); }
[单项选择]以下程序运行后,单击按钮输出结果是( )。
Private Sub Commandl_Click( )
Dim x As Integer,y As Integer,z As Integer
X=4:y=2: Z=3
Call Gopd(x,x,z)
Print x;X;Z
Call Gopd(x,y,y)
Print x;y;y
End Sub
Private Sub Gopd(x As Integer,y As Integer,z As Integer)
X=3 * Z + 1
y=2 * z
z=x + y
End Sub
[填空题]以下程序运行后的输出结果是【 】。
struct NODE
{int num;struct NODE *next;
};
main( )
{struct NODE s[3]={{1,’’/0’’},{2,’’/0’’},{3,’’0’’}},*p,*q,*r;
int sum=0;
s[0].next=s+1;s[1].next=s+2;s[2].next=s;
p=s; q=p->next; r=q->next;
sum+=q->next->num; sum+=r->next->next->num;
printf("%d/n",sum);
}
[填空题]以下程序运行后的输出结果是 【10】 。
#include
main( )
{ char a;
for(a=0;a<15;a+=5)
{ putchar(a+’A’); }
printf("/n");
}
[填空题]以下程序运行后的输出结果是 【10】
#include <iostream>
#include <string>
using namespace std;
class Y;
class X
{
int x;
char *strx;
public:
x(int a,char *str)
{
x=a;
strx=new char[strlen(str)+1];
strcpy(strx,str);
}
void show(Y &oB) ;
};
class Y
{
private:
int y;
char *stry;
public:
Y(int b,char *str)
{
y=b;
stry=new char[strlen(str)+1];
strcpy(stry, str);
}
friend void X::show(Y &oB) ;
};
void X::show(Y &oB)
{
cout<<strx<<",";
cout<<ob.stry<<end1;
}
int main( )
{
X a(10,"stringX");
Y b(20,"stringY");
a.show(B) ;
return 0;
}
[填空题]以下程序运行后的输出结果是 【15】 。
void fun( )
{
static int a=0;
a+=2;printf("%d",A) ;
}
main( )
{ int cc;
for(cc=1;cc<4,cc++)fun( );
printf("/n");
}
[填空题]以下程序运行后的输出结果是 【16】 。
struct NODE
int num;
stmct NODE *next;
;
main( )
struct NODE s[3]=1,’/0’),2,’/0’),3,’/0’),*p,*q,*r;
int sum=0;
s[0].next=s+1;
s[1].next=s+2;
s[2].next=s;
p=s
q=p->next;
r=q->next;
sum+=q->next->num;
sum+=r->next->next->num;
printf("%d/n",sum);
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
struct st
int x,y; data[2]=1,10,2,20;
main( )
struet st *p=data;
printf("%d,",p->y);printf("%d/n",(++p)->x);
A. 10,1
B. 20,1
C. 10,2
D. 20,2
[填空题]以下程序运行后的输出结果是【 】。
#include<string.h>
main( )
{char ch[]="abc",x[3][4];int i;
for(i=0;i<3;1++)strcpy(x[i],ch);
for(i=0;i<3;i++)printf("%s",&x[i][i];
printf("/n");
}
[单项选择]单击按钮时,以下程序运行后的输出结果是 Private Sub Commandl_Click( ) Dim X As Integer,y As Integer,z As Integer x=1:y=2: Z=3 Call God(x,x,z) Print x;x;z Call God(x,y,y) Print X;y;y End Sub Private Sub God(x As Integer,y As Integer,z As Integer) x=3 * Z + 1 y=2 * Z z=x + y End Sub
A. 6 6 12 7 11 11
B. 8 5 10 5 11 11
C. 9 6 12 9 10 15
D. 8 10 10 5 9 10