更多"有以下程序 #include<stdio.h> #include<"的相关试题:
[单项选择]有以下程序
#include<stdio.h>
#include<string.h>
Struct A
int a;char b[10];double c;;
struct A f(struct A t);
main( )
struct A a=1001,"ZhangDa",1098.0;
a=f(a);printf("%d,%s,%6.1f/n",a.a,a.b,a.c);
struct A f(Struct A t)
t.a=1002;strcpy(t.b,"WangPeng");t.c=1220.0;return t;
程序运行后的输出结果是______。
A. 1001,ZhangDa,1098.0
B. 1002,ZhangDa,1220.0
C. 1001,WangPeng,1098.0
D. 1002,WangPeng,1220.0
[填空题]以下程序运行后的输出结果是 【11】 。
#include <stdio.h>
struct NODE
int num;struct NODE * next;
main ( )
struet NODE s[3]= .’/0’,2,’/0’,3,’/O’,*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;
prinff( "% d /n", sum);
[填空题]阅读下列程序,则程序的输出结果为______。
#include"stdio.h"
struct ty
{ int data;
char c;};
main( )
{ struct ty a={30,’x’};
fun(a);
printf("%d%c",a.data,a.c);}
fun(struct ty b)
{ b.data=20;
b.c=’y’;}
[填空题]以下程序运行后的输出结果是 【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");
[单项选择]下列程序的输出结果是( )。
#include<stdio.h>
main( )
struct st
int y,x,z;
;
union
long i;
int j;
char k;
un;
printf("%d,%d/n",sizeof(struct st),sizeof(un));
A. 6,2
B. 6,4
C. 8,4
D. 8,6
[填空题]以下程序运行后的输出结果是______。
struct NODE
int k;
struct NODE*link;
;
main( )
struct NODEm[5],*p=m,*q=m+4;
int i=0:
while(p!=q)
p->k=++i;p++;q->k=1++;q--;
q->k=i:
for(i=0;i<5;i++)printf("%d",m[i].k);
printf("/n");
[填空题]以下程序运行后的输出结果是______。
struct NODE
{int hum;struct NODE *next;
} ;
main( )
{structNODE 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 <iostream>
#include <string>
using namespace std;
class base
private:
char baseName[10];
public:
base( )
strcpy(baseName,"Base");
virtual char *myName( )
return baseName;
char *className( )
Return baseName;
;
class Derived: public base
private:
char derivedName[10];
public:
Derived( )
strcpy(derivedName,"Derived" );
char *myName( )
return derivedName;
char *className( )
return derivedName;
;
void showPtr(base &p)
cout<<p.myName( )<<" "<<p.className( );
int main( )
base bb;
Derived dd;
showPtr(dd);
return 0;
运行后的输出结果为
A. Derived Base
B. Base Base
C. Derived Derived
D. Base Derived
[单项选择]有以下程序:
#include
usingnamespacestd;
#defineP13.14
classPoint
{private:
intX,y;
public:
Point(inta,intb)
{x=a:
y=b;}
intgetx()
{returnX;}
intgety()
{returny;}};
classCircle:publicPoint
{private:
intr;
public:
Circle(inta,intb,intc):Point(a,b)
{r=C;}
intgetr()
{returnr;}
doublearea()
{returnPI*r*r;}};
intmain()
(Circlec1(5,7,10);
cout< return0;}
程序执行后的输出结果是( )。
A. 314
B. 157
C. 78.5
D. 153.86