niusouti.com

下列程序的输出结果是()。includeusing namespace std;int main()于chara[]=”Hello,Te下列程序的输出结果是( )。 #include<iostream> using namespace std; int main() 于 chara[]=”Hello,Test”; Char*p=a; while(*p) { if(*p)=’a’&&*p(=’z’) cout<<char(*p+’A’-’a’); else cout<<*p; p++; } return 0

题目
下列程序的输出结果是()。includeusing namespace std;int main()于chara[]=”Hello,Te

下列程序的输出结果是( )。 #include<iostream> using namespace std; int main() 于 chara[]=”Hello,Test”; Char*p=a; while(*p) { if(*p)=’a’&&*p(=’z’) cout<<char(*p+’A’-’a’); else cout<<*p; p++; } return 0; }

A.hello,test

B.Hello,Test

C.HELLO,TEST

D.hELLO,tEST


相似考题
更多“下列程序的输出结果是()。#include<iostream>using namespace std;int main()于chara[]=”Hello,Te ”相关问题
  • 第1题:

    下列程序的输出结果是( )。 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。

  • 第2题:

    下列程序的输出结果是()。includeusing namespace std;int main(){char a[]="Hello,Te

    下列程序的输出结果是( )。 #include<iostream> using namespace std; int main() { char a[]="Hello,Test"; char*p=a; while(*p) { if(*p>='a'&&*p<='z') cout<<char(*p+'A'-'a'); else cout<<*p; p++; } re

    A.hllo,test

    B.Hello,Test

    C.HELLO,TEST

    D.hELLO,tEST


    正确答案:C
    解析: 用一个指针变量p指向字符数组a,在while循环中,当不指向数组尾时,将小写字母转换为大写字母,然后将其输出。

  • 第3题:

    下列程序的输出结果是 include usingnamespacestd; int main () {chara []="Hello,W

    下列程序的输出结果是 #include <iostream> using namespace std; int main () { char a [] = "Hello,World": char*ptr = a; while (*ptr) { if(*ptr>= 'a' &&*ptr <='z' cout<<char{*ptr+'A'-'a'); else cout<<*ptr; ptr++; } return 0; }

    A. HELLO. WORLD

    B. Hello, World

    C. hELLO, wORLD

    D. hello, world


    正确答案:A
    解析:本题考核while语句和if语句,while语句中if语句的作用是将小写字母变成大写字母输出、所以main函数的字符串通过while语句全部输出为大写字母。

  • 第4题:

    下列程序的输出结果是()。includeusing namespace std;int main(){char a[]="Hello,Te

    下列程序的输出结果是( )。 #include<iostream> using namespace std; int main() { char a[]="Hello,Test"; char *p=a; while(*p) { if(*p>='a'&&*p<='’z') cout<<char(*p+'A'-'a'); else cout<<*p; p++; } return 0; }

    A.hello,test

    B.Hello,Test

    C.HELLO,TEST

    D.hELLO,tEST


    正确答案:C
    解析:用一个指针变量p指向字符数组a,在while循环中,当不指向数组尾时,将小写字母转换为大写字母,然后将其输出。

  • 第5题:

    下列程序的输出结果是()。includeusing namespace std;int main(){char a[]=""Hello,W

    下列程序的输出结果是( )。 #include<iostream> using namespace std; int main() { char a[]=""Hello,World"; char*ptr = a; while(*ptr) { if(*ptr>= 'a' &&*ptr<='z') cout<<char(*ptr+'A'-'a'); else cout<<*ptr; ptr++; } retur 0; }

    A.HELLO, WORLD

    B.Hello, World

    C.HELLO, world

    D.hello, world


    正确答案:A