更多"以下程序的运行结果是______。 #include<iostrea"的相关试题:
[填空题]
以下程序运行时输出结果是()。
#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));
}
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
#include<string.h>
void fun(char *s[],int n)
char *t;int i,j;
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(strlen(s[i])>strlen(s[j]))t=s[i];s[i]=s[j];s[j]=t;
main( )
char *ss[]="bcc","bbcc","xy","aaaacc","aabce";
fun(ss,5);printf("%s,%s/n",ss[0],ss[4]);
A. xy,aaaace
B. aaaacc,xy
C. bcc,aabcc
D. aabcc,bcc
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
#include<stdlib.h>
int fun(int n)
int *p;
p=(int*)malloe( sized ( int ));
* p=n; return * p;
main( )
int a;
a=fun(10);printf("%d/n",a+fun(10));
A. 0
B. 10
C. 20
D. 出错
[填空题]以下程序运行的结果是 【14】 。
#include<conio.h>
#include<stdio.h>
#define M 100
void fun(int m,int*a,int*n)
int i,j=0;
for(i=1;i<=m;i++)
if(i%7==0‖i%11==0)
a [j++]=i;
*n=j;
main( )
int aa[M],n,k;
clrscr( );
fun(10,aa,&n);
for(k=0;k<n;k++)
if((k+1)%20==0)printf("/n");
else printf("%4d",aa[k]);
printf("/n");
[填空题]53. 以下程序运行后的输出结果是 。
#include <stdio.h>
#include <string.h>
char * ss(char * s)
char * p,t;
p=s+1:t= *s:
whilet * p) *(,p-1) = *p; p++;
* (p-1) =t;
return s :
main ( )
char * p,str[10] =" abedefgh";
p = ss(str); printf( "% s //n". p):
[填空题]以下程序运行后输出结果是 【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);
}
[填空题]以下程序运行后的输出结果是 【10】 。
#include
main( )
{ char a;
for(a=0;a<15;a+=5)
{ putchar(a+’A’); }
printf("/n");
}
[填空题]以下程序运行后的输出结果是 【17】 。
#include <stdio, h>
#include <string, h>
main( )
char ch[] ="abc".,x[3] [4]: int i:
for(i=0;i<3:i ++) strcpy(x[i] ,ch):
for(i =0;i<3:i++) printf( "% s" ,&x[i] [i]);
printf(" /n" )
[填空题]以下程序运行后的输出结果是 【16】 。
#include <stdio, h>
#include <stating, h>
void fun(char * s,int p,int k)
int i;
for(i=p;i<k-1;i++) s[i] =s[i+2];main( )
char s [] = "abedefg";
fun(s,3 ,strlen(s) ); puts(s);
[填空题]以下程序的运行结果是 【10】 。
#include<iostream>
#include<string>
using namespace std;
void main( ){
chara[10]="China",b[]="Chin",c[]="ese";
cout<<strlen(strcat(strcpy(a,b),c))<<endl;
}
[填空题]以下程序运行后的输出结果是 【15】 。
#include <stdio.h>
#include <string.h>
char * ss(char * s)
char * p,t;
p=s+1:t= *s:
whilet * p) *(,p-1) = *p; p++;
* (p-1) =t;
return s :
main ( )
char * p,str[10] =" abedefgh";
p = ss(str); printf( "% s /n". p):
[填空题]以下程序运行后的输出结果是 【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;
[填空题]以下程序运行后的输出结果是 【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;
}
[填空题]以下程序运行时输出到屏幕的结果是【16】 。
#include
#include
void main( )
{ int i=0,n=0;char s[80],*p;
strcpy(s,"It is a book.");
for(p=s;p!=’/0’;p++)
if(*p==’ ’)
i=0;
else
if(i==0)
{n++;i=1; }
printf("%d/n",n);
}
[填空题]以下程序运行时输出到屏幕的结果是【10】。
#include
int fun(int *x,int n)
{if(n==0) return x[0];
else return x[0]+fun(x+1,n-1);
}
void main( )
{int a[ ]={1,2,3,4,5,6,7};
printf("%d/n",fun(a,2));
[填空题]以下程序运行时输出到屏幕的结果是 【7】。
#include
void main( )
{int i=1,m=0;
switch(i)
{ case 1:
case 2: m++;
case 3: m++;
}
printf("%d",m);
}