更多"以下程序的运行结果是 【8】 。
x=1.5
DO C"的相关试题:
[填空题]以下程序的运行结果是 【8】 。
x=1.5
DO CASE
CASE x>2
y=2
CASE x>1
y=1
ENDCASE
y
[填空题]以下程序的运行结果是 【8】 。
x=1.5
DO CASE
CASE x>2
y=2
CASE x>1
y=1
ENDCASE
y
[填空题]以下程序运行后的输出结果是______。
main( )
int i=10,j=0;
do
j=j+i;i--;
while(i>2);
printf("%d/n",j);
[填空题]请在以下程序第一行的下划线处填写适当内容,使程序能正确运行。
【 】( double,double);
main( )
{ double x,y;
scanf("%lf%lf",&x,&y);
printf("%lf/n",max(x,y));
}
double max(double a,double b)
{ return(a>b a:b); }
[填空题]以下程序运行后的输出结果【 】。
struct NODE
{int k;
struct NODE *link;
};
main( )
{structNODEm[5],*p=m,*q=m+4;
int i=0;
while(p!=q){
p->k=++i;p++;
q->k=i++;q-;
}
q->k=i;
for(i=0;i<5;i++)printf("%d",m[i].k);
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
A. 6 6 12
B. 8 5 10
C. 9 6 12
D. 8 10 10
[填空题]以下程序运行后的输出结果是【 】。
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);
}
[填空题]以下程序运行后的输出结果是 【17】 。
struct NODE
{ int k;
struct NODE*link;
};
main( )
{ struct NODE m[5],*p=m,*q=m+4;
int i=0;
while(p!=q){
p->k=++i;p++;
q->k=i++;q--;
}
q->k=i;
for(i=0;i<5;i++)printf("%d",m[i].k);
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
[填空题]以下程序运行后的输出结果是 【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);
[填空题]以下程序运行后的输出结果是 【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);
}
[填空题]以下程序运行后的输出结果是 【10】 。
#include <iostream>
#include <string>
using namespace std;
class Y;
class X
{
iht 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:
iht 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<<endl;
}
int main( )
{
X a(10,"stringX");
Y b(20,"stringY");
a.show(b);
return 0;
}
[填空题]以下程序运行后的输出结果是 【14】 。
#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 O;
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
#include<stdlib.h>
main( )
int *a, *b, *c;
a=b=c(int *) malloc(sizeof(int));
*a=1; *b=2; *c=3;
a=b;
printf("%d, %d, %d/n", *a, *b, *c);
A. 3,3,3
B. 2,2,3
C. 1,2,3
D. 1,1,3