下列程序的输出结果是()。includevoid main(){char*Str;str="testI";cout下列程序的输出结果是( )。 #include<iostream.h> void main() { char*Str; str="testI"; cout<<str[5]; }A.test!B.testC.空字符D.异常

题目
更多“下列程序的输出结果是()。#include<iostream.h>void main(){char*Str;str="testI";cout<<str[5];} ”相关问题
  • 第1题:

    下面程序的结果是 #include"iostream.h" void main( ) { char * str; str="test!"; cout<<str[5]; }

    A.程序错误

    B.!

    C.'\0'

    D.为空字符


    正确答案:D
    解析:'\o'输出为不显示,只代表一个字符串的结束。注意:C++语言中各种字符转义序列的意义和应用。

  • 第2题:

    下面程序的结果是 #include"iostream.h" void main() { char*str; Str="test!"; cout<<str[5]; }

    A.程序错误

    B.!

    C.'\0'

    D.为空字符


    正确答案:D

  • 第3题:

    下列程序的输出结果是______。 include int CalcDigital(char*str) { if(str= =NULL)

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

    include<iostream.h>

    int CalcDigital(char*str)

    {

    if(str= =NULL)

    return 0;

    int num_of_digital=0;

    for(int i=0;str{i]!=0x0;i++)

    if(str[i]<='9'&& str[i]>='0')

    num_of_digital++;

    return num_of_digital;

    }

    void main( )

    {

    char a[]="Beijing20080lympic";

    cout<<CalcDigital(a)<<endl;

    }


    正确答案:4
    4 解析:分析本题可知函数功能为计算一个字符串中包含的数字个数。字符串中包含的数字有2008,故输出为4。

  • 第4题:

    下面程序的结果是 #include"iostream.h" void main() { char*str; str="test!"; cout<<str[5]; }

    A.程序错误

    B.!

    C.’\0’

    D.为空字符


    正确答案:D
    解析:‘\0’输出为不显示,只代表一个字符串的结束。注意:C++语言中各种字符转义序列的意义和应用。

  • 第5题:

    下面程序的结果是( )。 #include"iostream.h" void main() { char*str: str="test!"; cout<<str[5]: }

    A.程序错误

    B.!

    C.'\0'

    D.为空字符


    正确答案:D