更多"以下程序的运行结果是______。 #include <stdio."的相关试题:
[填空题]以下程序运行结果是 【10】 。
#include<stdio.h>
long fib(int g)
switch(g)
case 0:return 0;
case 1:
case 2:return 1;
return(fib(g-1)+fib(g-2));
main( )
long k;
k=fib(5);
printf("k=%5ld/n",k);
[填空题]以下程序的运行结果是______。
#include<stdio.h>
long fib(int g)
switch(g)
case 0:return 0;
case 1:
case 2:return 1;
return(fib(g-1)+fib(g-2));
main( )
long k;
k=fib(5);
printf("k=%51d/n",k);
[填空题]以下程序的运行结果是______。
#include <stdio.h>
long fib(int g)
switch(g)
case 0: return 0;
case 1:
case 2: return1;
return(fib(g-1)+fib(g-2));
main( )
long k;
k=fib(5);
printf("k=%5ld/n",k);
[填空题]以下程序运行时输出到屏幕的结果是【11】 。
#include
long f(int n)
{static long s;
if(n==1) return s=2;
else return ++s;
}
void main( )
{long i,sum=0;
for(i=1;i<4;i++,) sum+=f(i);
printf("%ld",sum);
}
[单项选择]以下程序的输出结果是
#include<iostream.h>
long fun(int n)
long s;
if(n=1||n=2)s=2;
else s=n-fun(n-1);
return s;
void main( )
cout<<fun(3);
A. 1
B. 2
C. 3
D. 4
[单项选择]有如下程序:
#include <stdio.h>
long fib(int n)
if(n>2)return(fib(n-1)+fib(n-2));
else return(2);
main( )
printf("%d/n",fib(3));
该程序的输出结果是( )。
A. 2
B. 4
C. 6
D. 8
[填空题]阅读下面程序:
#include <iostream.h>
long fib(int n)if (n>2)
return (fib(n-1) + fib(n-2));
else
return (2);void main( )cout<<fib(3)<<end1;则该程序的输出结果应该是 【12】 。
[填空题]下列程序的运行结果是______。
# include<stdio.h>
long func(int x)
long p;
if(x==0||x==1)
return(1);
p=x*func(x-1);
return(p);
main( )
printf("%d/n",func(4));
[填空题]下列程序的运行结果是______。
#include<stdio.h>
long func(int x)
long p;
if(x==O‖x==1)
return(1);
p=x*func(x-1);
return(p);
main( )
printf("%d/n",func(4));
[填空题]以下程序运行后输出结果是 【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");
}
[填空题]以下程序运行后输出结果是 【7】 。
#include
main( )
{ int a=37;
a%=9; printf("%d/n",a);
}
[填空题]以下程序运行后的输出结果是【 】。
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