下列程序的输出结果是______。includeinclude using namespace std;void下列程序的输出结果是______。include <iostream.h>include <cstring.h>using namespace std;void fun(const char*s,char &C) {c=s[strlen (s)/2];}int main {){char str [] ="ABCDE";char ch=str[1];fun(str,sh);cout<<Ch;ret

题目
下列程序的输出结果是______。includeinclude using namespace std;void

下列程序的输出结果是______。

include <iostream.h>

include <cstring.h>

using namespace std;

void fun(const char*s,char &C) {c=s[strlen (s)/2];}

int main {)

{

char str [] ="ABCDE";

char ch=str[1];

fun(str,sh);

cout<<Ch;

return 0;

}


相似考题
更多“下列程序的输出结果是______。include<iostream.h>include <cstring.h>using namespace std;void ”相关问题
  • 第1题:

    下列程序的输出结果是【】。 include include void main(){ char b[30]; str

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

    include<iostream.h>

    include<string.h>

    void main(){

    char b[30];

    strcpy(&b[0],"XY");

    strcpy(&b[1],"YZW");

    strcpy(&b[2],"ZXY");

    cout<<b<<end1;

    }


    正确答案:XYZXY
    XYZXY

  • 第2题:

    下列程序的运行结果是______。include class Base { public: void f(int x){cout<<“B

    下列程序的运行结果是______。

    include<iostream.h>

    class Base

    {

    public:

    void f(int x){cout<<“Base:”<<x<<endl;}

    );

    class Derived:public Base

    {

    public:

    void f(char*str){cout<<“Derived:”<<str<<endl;}

    };

    void main(void)

    {

    Base*pd=ne


    正确答案:Base:97。
    Base:97。 解析: 本题主要考查两个知识点,一是基类指针可以指向派生类对象,并可以访问派生类的所有成员。二是在函数重载中进行隐式类型转换。如pd->f(‘a’);系统到底调用哪个重载函数呢?实参既不是派生类中的形参,也不是基类中f函数的形参类型。此时系统根据就近原则和从高优先级到低优先级的规则尝试隐式转换。单字符更接近整数,故调用的是基类的f函数。

  • 第3题:

    下面程序的输出结果是()。includeinclude"stdng.h"void main(){ char a[]="welcome

    下面程序的输出结果是( )。 #include<iostream.h> #include"stdng.h" void main() { char a[]="welcome",b[]="well"; strcpy(a,b); cout<<a<<endl; }

    A.wellome

    B.wellcom

    C.well

    D.wellwe


    正确答案:C

  • 第4题:

    下面程序的输出结果是()。includeinclude"string.h"void main(){char a[]="Hello T

    下面程序的输出结果是( )。 #include<iostream.h> #include"string.h" void main() {char a[]="Hello Test",b[]="Test"; strcpy(a,b); cout<<a<<end1; } A) B)

    C) D)

    A.Hello

    B.Test

    C.Hello Test

    D.Hello Test HelloTest


    正确答案:B

  • 第5题:

    下列程序的输出结果是( )。 include include"string.h" void main() {char a[]="He

    下列程序的输出结果是( )。 #include<iostream.h> #include"string.h" void main() {char a[]="Hello Test",b[]="Test"; strcpy(a,b); cout<<a<<end1; }

    A.Hello

    B.Test

    C.Hello Test

    D.Hello Test HelloTest


    正确答案:B
    解析:程序中首先定义字符数a和b,其值分别为“Hello Test”和“Test”。然后利用strcpy复制函数,将b的值复制给a,所以输出a的结果为Test。