更多"写出下列程序段的输出结果。(假设此栈中元素的类型是char) vo"的相关试题:
[简答题]写出下列程序段的输出结果。(假设此栈中元素的类型是char)
voide main( )
stack s;
char x,y;
InitStack(s)
x=‘1’,y=‘0’
push(s,x);
push(s,x);
push(s,y);
push(s,x);
push(s,‘e’);
push(s,x);
pop(s,x);
push(s,‘h’);
while(!stackEmpty(s))
pop(s,y);
printf(y);
prinft(x)
[简答题]请在该程序段右侧写出其输出结果。
main( )
{char *s="121";
int k=0,a=0,b=0;
do{
k++:
if(k%2==0)
{a=a+s[k]-’0’;continue;)
b=b+s[k]-’0’;
a=a+s[k]-’0’;}while(s[k+1]);
printf("k=%d a=%d b=%d/n",k,a,b);
}
[简答题]请在该程序段右侧写出其输出结果。
main( )
{int n[3],j,k,l;
for(j=0;j<3;j++)
n[j]=0;
l=3:
for(j=0;j<l;j++)
for(k=0;k<l;k++)
n[k]=n[j]+1:
print(("%d/n",n[1]);
}
[单项选择]请在该程序段右侧写出其输出结果。
int aa[3][3]=2,4,6;
main( )
int j,*p=&aa[0][0];
for(j=0;j<2;j++)
if(j==0)
aa[j][j+1]=*p+1;
else++P;
print(("%d",*p);
[简答题]请在该程序段右侧写出其输出结果。
fun3(int x)
{static int a=3;
a+=x;
return(a);}
main( )
{int k=2,m=1,n;
n=fun3(k);
n=fun3(m);
printf("%d/n",n);)
[简答题]请在该程序段右侧写出其输出结果。
int aa[3][3]={{2},{4},{6}};
main( )
{int j,*p=&aa[0][0];
for(j=0;j<2;j++)
{if(j==0)
aa[j][j+1]=*p+1;
else++P;
print(("%d",*p);}
}
[单项选择]下面程序段的输出结果是
classTest
public static void main(Stringargs[])
MyThread t=new MyThread( );
t.displayOutput(”t has been createD) ”);
t.start( );
Class MyThread extends Thread
public void displayOutput(Strings)
System.out.println(S);
public void run( )
displayOutput(”t is running.”);
A. thas been created.
B. thas been created
C. t is running.
D. 编译出错
[单项选择]下面程序段的输出结果是 class Test{ public static void main(String args[]){ MyThread t=new MyThread( ); t.displayOutput("t has been createD) "; t.start( ); } } class MyThread extends Thread{ public void displayOutput(String s){ System.out.println(s); } public void nm( ){ displayOutput("t is running. "); }
A. t has been create t is runnin
B. t has been create
C. t is runnin
D. 编译出错
[填空题]阅读下面程序段,则执行后输出的结果是 。
#include "stdio.h"
main( )
char fun(char,int);
char a=’A’;
int b=13;
a=fun(a,b);
putchar(a);
char fun(char a,int b)
char k;
k=a+b;
return k;
[填空题]阅读下面程序段,执行后输出的结果是______。
#include "stdio.h"
main( )
char fun(char,int);
char a=’A’;
int b=13;
a=fun(a,b);
putchar(a);
char fun(char a,int b)
char k;
k=a+b;
return k;
[单项选择]下列程序段的输出结果为( )。
#include<stdio.h>
main( )
static char a[]="language";
char *p;
p=a;
for(p=a;p<a+8;p+=2)
putchar(*p);
A. language
B. lnug
C. 有语法错误
D. lang
[填空题]阅读下面程序段,则执行后输出的结果是______。
#include"stdio.h"
main( )
char fun(char,int);
char a=’A’;
int b=13;
a=fun(a,b);
putchar(a);
charfun(char a,int b)
char k;
k=a+b;
return k;
[填空题]下列程序段的输出结果是 【11】 。
main( )
char b[]="Hello,you";
b[5]=0;
printf("%s/n",b);
[填空题]下列程序段的输出结果是 【9】 。
main( )
{char b[]="Hello,you";
b[5]=0;
printf("%s/n",B) ;
}
[填空题]下列程序段的输出结果是 [7] 。
#include<iostream.h>
void main( )
int i=10,sum=0;
do
sum=+sum+i;
i=i-2;
while(i>=2);
cout<<sum<<end1;