单项选择题

下列程序的输出结果是______。 #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
<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序 #include <iostream> using namespace std; class MyClass { public: MyClass(int n) { number=n; } 拷贝构造函数 MyClass(MyClass& other) {number=other. number;} -MyClass() {} private: int number; }; MyClass fun(MyClass p) { MyClass temp(p); return temp; } int main() { MyClass obj1(10), obj2(0); MyClass obj3(obj 1); obj2=fun(obj3); return 0; } 程序执行时,MyClass 类的拷贝构造函数被调用的次数是______ 次。
A.5
B.4
C.3
D.2
单项选择题
有以下类定义: class Point { public: Point(int x=0,int y=0){_x=x; _y=y;} void Move(int x Off, int y Off) {_x+=x Off; _y+=y Off; } void Print() const { cout <<’(’ << _x << ’,’ << _y << ’)’<< end 1;} private: int _x,_y; }下列语句中会发生编译错误的是______。
A.Point pt; p Print();
B.const Point pt; p Print();
C.Point pt; p Move(1,2);
D.const Point pt; p Move(1,2);
相关试题
  • 下列程序的输出结果是 【15】 。#incl...
  • 下列程序输出结果是 【13】 。include...
  • 与成员访问表达式p→name 等价的表达式是...
  • 下面是用来计算n的阶乘的递归函数,请将该...
  • 请按下面注释的提示将类B的构造函数定义补...