下列程序的输出结果是 #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
第1题:
下列程序的输出结果是
#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
第2题:
程序的输出结果是【 】。
include <iostream>
using namespace std;
class A{
int x;
public:
A(int x=1):x(x){cout<<x;}
};
void main(){
A a,b(2),c(3);
}
第3题:
以下程序的输出结果是【 】。
include <iostream>
using namespace std;
int main()
{
char S[ ]="abcdef";
s[3]='\0';
cout<<s<<end1;
return 0;
}
第4题:
以下程序的输出结果是【 】。
include<iostream>
using namespace std;
int main(){
int sum,i;
for(sum=0,i=1;i<5;i++)sum+=i;
cout<<sum<<endl;
return 0;
}
第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++; } return 0; }
A.HELLO,WORLD
B.Hello,World
C.hELLO, wORLD
D.hello,world
第6题:
下列程序的输出结果是( )。 #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
第7题:
以下程序的输出结果是【 】。
include<iostream.h>
void main( )
}
int a=0;
a+=(a=8) ;
cout<<a;
}
第8题:
下面程序的输出结果为______
include<iostream.h>
void main()
{
cout<<"Hello\b";
}
第9题:
下列程序的输出结果是【 】。
include <iostream>
using namespace std;
int main()
{
int data=1;
int &r = data;
data+=5;
r+=5;
cout<<data<<end 1;
return 0;
}
第10题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
void fun(int &rf)
{
rf*=2;
}
int main()
{
int num=500;
fun(num);
cout<<num<<endl;
return 0;
}