更多"以下程序运行后的输出结果是【 】。
#include<st"的相关试题:
[填空题]以下程序运行后的输出结果是【 】。
#include<string.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[]="abcdefg";
fun(s,3,strlen(s));puts(s)
}
[填空题]下列程序运行后的输出结果是 【15】 。
#include<iostream.h>
void fun(int,int,int *);
void main( )
{
int x,y,z;
fun(5,6,&x);
fun(7,x,&y);
fun(x,y,&z);
cout<<x<<","<<y<<","<<z<<endl;
}
void fun(int a,int b,int *c)
{
b+=a;
*c=b-a;
}
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
#include<string.h>
main( )
char x[]="STRING";
x[0]=0; x[1]='/0'; x[2]='0';
printf("%d%d/n", sizeof(x),strlen(x));
A. 6 1 B) 7 0 C) 6 3 D) 7 1
[填空题]以下程序运行后输出结果是 【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);
}
[单项选择]以下程序运行后的输出结果是
#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. 出错
[单项选择]以下程序在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
[填空题]以下程序运行后的输出结果是 【10】 。
#include
main( )
{ char a;
for(a=0;a<15;a+=5)
{ putchar(a+’A’); }
printf("/n");
}
[单项选择]以下程序运行后的输出结果是()
#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. 出错
[填空题]以下程序运行后输出结果是 【11】 。
#include
void fun(int x)
{ if(x/5>0) fun(x/5);
printf("/%dn",x);
}
main( )
{ fun(11); printf("/n"); }
[单项选择]以下程序运行后的输出结果是
#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
[填空题]以下程序运行后的输出结果是 【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;
}