Câu 42: CPP: C++ Certified Professional Programmer
Which pieces of code inserted independently into places marked 1 and 2 will cause the program to compile and display: 0 1 2 3 4 5 6 7 8 9? Choose all that apply.#include #include using namespace std;class A { int a; public:A(int a){ this?>a=a;}//insert code here 1};//insert code here 2template void print(T start, T en…
Nội dung câu hỏi
Which pieces of code inserted independently into places marked 1 and 2 will cause the program to compile and display: 0 1 2 3 4 5 6 7 8 9? Choose all that apply.#include #include using namespace std;class A { int a; public:A(int a){ this?>a=a;}//insert code here 1};//insert code here 2template void print(T start, T end) {while (start != end) {std::cout l1(t1, t1 + 5);A t2[] ={ 3, 2, 6, 9, 0 };list l2(t2, t2 + 5);l1.sort();l2.sort();l1.merge(l2);print(l1.begin(), l1.end());print(l2.begin(), l2.end()); cout<<endl;return 0;}
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. place 1: operator int() { return a; } — đáp án hiện tại
- B. place 1: operator int() { return a; }bool operator a< b.a;} — đáp án hiện tại
- C. place 1: bool operator a< b.a;}
- D. place 1: bool operator a< b.a;} friend ostream & operator <<(ostream & c, const A & a); place 2: ostream & operator <<(ostream & c, const A & a) { c<<a.a; return c;} — đáp án hiện tại
- E. place 1: bool operator a< b.a;} place 2: ostream & operator <<(ostream & c, const A & a) { c<<a.a; return c;}
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.