下列程序的输出结果是
#inClUde<iostream>
using namespace std;
intmain()
{
Char a[]="HellO,World";
Char*ptr=a;
while(*ptr)
{
if(*ptr>='a'&& *ptr <='Z')
cout<<char(*ptr+'A' -'a');
else cout<<*ptr;
ptr++;
}
retur0;
}
A.HELLO,WORLD
B.Hello,world
C.hELLO,wORLD
D.hellO,world
第1题:
下列程序的输出结果是( )。 #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
第2题:
有下列程序段: #include <iostream> using namespace std; int main() { char b[] = "Hello,you"; b[5] = 0; cout<<b<<end1; return 0; } 执行此程序后,得到的输出结果是( )。
A.Hello,you
B.Hello0you
C.Hello
D.0
第3题:
下列程序的输出结果是 #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
第4题:
下面程序输出的结果是( )。 #include<iostream> using namespace std; int fuc (char *x); int main(){ cout<<fuc("hello")<<endl; return 0; } int fuc(char *x){ char *y=x; while(*y! ='\0')y++; return(y-x); }
A.5
B.6
C.0
D.语法错误,不能输出结果
第5题:
下列程序的输出结果是( )。 #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