Câu 52: CPP: C++ Certified Professional Programmer
What happens when you attempt to compile and run the following code?#include #include #include using namespace std;template void print(T start, T end) {while (start != end) {std::cout l1(t1, t1 + 10); list l2(l1); l2.reverse(); l1.splice(l1.end(),l2); l1.unique(); print(l1.begin(), l1.end()); cout<<endl; return 0;}
Nội dung câu hỏi
What happens when you attempt to compile and run the following code?#include #include #include using namespace std;template void print(T start, T end) {while (start != end) {std::cout l1(t1, t1 + 10); list l2(l1); l2.reverse(); l1.splice(l1.end(),l2); l1.unique(); print(l1.begin(), l1.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. compilation error
- B. program outputs: 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 — đáp án hiện tại
- C. program outputs: 1 2 3 4 5 6 7 8 9 10 10 9 8 7 6 5 4 3 2 1
- D. program outputs: 1 2 3 4 5 6 7 8 9 10
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.