下列程序的输出结果是( )。 #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
第1题:
执行如下程序后的输出结果是【 】。
include <iostream>
include <fstream>
using namespace std;
int main ( )
{
char s[25];
ofstream fl("data.txt");
f1<<"C++ Programming";
f1.close ();
ifstream f2 ("data.txt");
第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()
{
int data=1;
int &r = data;
data+=5;
r+=5;
cout<<data<<end 1;
return 0;
}
第4题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
void fun(int &rf)
{
rf*=2;
}
int main()
{
int num=500;
fun(num);
cout<<num<<endl;
return 0;
}
第5题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
int main()
{
int data=l;
int &r = data;
data+=5;
r+=5;
cout<<data<<endl;
return 0;
}
第6题:
下列程序的输出结果是( )。 #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
第7题:
若有如下程序段:
include <iostream>
using namespace std;
int main()
{
char *p="abcdefgh",*r;
long *q;
q=(long *)p;q++;
r=(char *)q;
cout<<r<<end1;
return 0;
}
该程序的输出结果是______。
第8题:
若有以下程序:
include <iostream>
using namespace std;
int main()
{
char str[10];
cin>>str;
cout<< str<<end1;
return 0;
}
当输入为:
This is a program!
那么执行程序后的输出结果是【 】。
第9题:
下列程序的输出结果是( )。 #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
第10题:
有以下程序: #include<iostream> #include<string> using namespace std; int main() { char arr[2][4]; strcpy(arr[0],"you"); strcpy(arr[1],"me"); arr[0][3]='&'; cout<<arr[0]<<end1; return 0; } 执行后的输出结果是( )。
A.you&me
B.you
C.me
D.err
第11题:
有下列程序段: #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
第12题:
下列程序的输出结果是 #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
第13题:
下列程序的输出结果是( )。 #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
第14题:
下列程序的输出结果是______。 #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
第15题:
以下程序的输出结果是【 】。
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;
}
第16题:
下面程序运行输出的结果是【 】。
include <iostream>
using namespace std;
int main(){
char a[]="Chinese";
a[3]='\0';
cout<<a<<endl;
return 0;
}
第17题:
下列程序的输出结果为( )。 #include (iostream) using namespace std; void main( ) char,a[ ] = { "hello" ," the" ," world" }; char * * pa = a: pa + +; cout << * pa << ENDL; }
A.hello
B.the
C.world
D.hellotheworld
第18题:
下列程序的输出结果是【 】
include<iostream>
using namespace std;
int main()
{
int num=500;
int &ref=num;
ref +=100;
cout<<num<<end1;
return 0;
}
第19题:
有以下程序,其输出结果是( )。 #include <iostream> using namespace std; int main(){ char a[10]={'1','2','3','4','5','6','7','8','9',0},*p; int i=8; p=a+i; cout<<p-3<<endl; return 0; }
A.6789
B.6
C.789
D.'6'
第20题:
下列程序的输出结果是______。
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;
}
第21题:
下列程序的输出结果是【 】
include<iostream>
using namespace std;
int &get Var(int*pint)
{
return *pint;
}
int main()
{
int a=10;
getvar(&A) =20;
cout<<a<<end1;
return 0;
}
第22题:
下面程序输出的结果是( )。 #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.语法错误,不能输出结果
第23题:
下面的程序输出的结果是( )。 #include <iostream> using namespace std; void main(){ int a=2; int &c=a; a++; cout<<c; }
A.2
B.3
C.4
D.*a