以下程序的输出结果是【】。 include viod main() {char sl[5]= "ABCD", s2=[5];int k以下程序的输出结果是【 】。include<iostream. h>viod main() {char sl[5]= "ABCD", s2=[5];int k;for(k=0;k<4:k++)s2[k]=(sl[k]- '0' +1) + '0' ;s2[k]= '\0' ;cout<<s2;

题目
以下程序的输出结果是【】。 include viod main() {char sl[5]= "ABCD", s2=[5];int k

以下程序的输出结果是【 】。

include<iostream. h>

viod main() {

char sl[5]= "ABCD", s2=[5];

int k;

for(k=0;k<4:k++)

s2[k]=(sl[k]- '0' +1) + '0' ;

s2[k]= '\0' ;

cout<<s2;


相似考题
更多“以下程序的输出结果是【】。 include<iostream. h> viod main() {char sl[5]= "ABCD", s2=[5];int k ”相关问题
  • 第1题:

    以下程序段的输出结果是 ______。includevoid main(){ char*p[5]={"ABCD","EF","GHI

    以下程序段的输出结果是 ______。 #include<iostream.h> void main(){ char*p[5]={"ABCD","EF","GHI","JKL","MNOP"}; char **q=p; int i; for(i=0;i<=4;i++) cout<<q[i]; }

    A.ABCDEFGHIJKL

    B.ABCD

    C.ABCDEFGHIJKMNOP

    D.AEGJM


    正确答案:C

  • 第2题:

    以下程序的输出结果是()。includeint fan(int);main(){int w=5; fun(w);printf("\n");}

    以下程序的输出结果是( )。 #include <stdio.h> int fan(int); main() { int w=5; fun(w); printf("\n"); } fun(int k) { if(k>0) fun(k-1); printf("%d",k); }

    A.5 4 3 2 1

    B.0 1 2 3 4 5

    C.1 2 3 4 5

    D.5 4 3 2 1 0


    正确答案:B
    解析:本题考查函数的递归调用。fun函数共被调用6次,即fun(5)、fun(4)、fun(3)、fun(2)、fun(1)、fun(0),其中fun(5)是main函数调用的,其余是在fun函数中调用的。

  • 第3题:

    以下程序的输出结果是( )。 include void swap(int*a,int*B){int*t; t=a;a=b;b=c;} main

    以下程序的输出结果是( )。 include<stdio.h> void swap(int*a,int*B){int*t; t=a;a=b;b=c;} main() {int i=3,j=5,*p=&i,*q=&j; swap(p,q);printf("%d %d\n",*p,*q); }


    正确答案:3 5
    3 5 解析:本题考查函数中形参和实参的传递。在C语言函数中实参和形参传递具有不可逆性,参数只能由实参传向形参,而不能由形参传向实参,虽然swap函数的功能是实现两个数的交换,但由于没有返回值,故最终的输出结果为3 5。

  • 第4题:

    以下程序的输出结果是_______。includeincludefun(char*w,int n){char t,*s

    以下程序的输出结果是_______。 #include<stdio.h> #include<string.h> fun(char*w,int n) { char t,*s1,*s2; s1=w;s2=w+n-1; while(s1<s2) { t=*s1++: *sl=*s2-; *s2=t; } } main() { char*p; p="1234567"; fun(p,strlen(p)); puts(p); }

    A.1234567

    B.7654321

    C.1711717

    D.7177171


    正确答案:C
    解析:在于函数fun中,s1为字符串w的起始地址,s2为字符串的结束地址(字符'\0'除外),当执行循环结束循环,w="1711717"。

  • 第5题:

    以下程序的输出结果是( )。 include main() {char*s1,*s2,m; s1=s2=(char*)malloc(size

    以下程序的输出结果是( )。

    include<stdlib.h>

    main()

    {char*s1,*s2,m;

    s1=s2=(char*)malloc(sizeof(char));

    *s1=15;

    *s2=20;

    m=*s1+*s2:

    printf("%d\n",m);

    }


    正确答案:40
    40 解析:malloc()函数的作用是开辟一个长度为sizeof(char)的内存区,s1、s2为指向字符型数据的指针变量,执行“s1=s2=(char*)malloc(sizeof(chat));”语句后,s1、s2指向同一个存储空间,此时m=*s1+*s2=20+20=40。