Câu 23: 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 v;multiset s;for(int i=10; i>0; i??) {v.push_back(i); s.push_back(i);}print(v.begin(), v.end()); print(s.begin(), s.end());cout<<endl;…
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 v;multiset s;for(int i=10; i>0; i??) {v.push_back(i); s.push_back(i);}print(v.begin(), v.end()); print(s.begin(), s.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. program outputs: 10 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10
- B. program outputs: 10 9 8 7 6 5 4 3 2 1 10 9 8 7 6 5 4 3 2 1
- C. program outputs: 10 9 8 7 6 5 4 3 2 1 and unpredictable sequence of numbers range 1 to 10
- D. compilation error — đáp án hiện tại
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.