Câu 34: CPP: C++ Certified Professional Programmer
What will happen when you attempt to compile and run the following code?#include #include #include using namespace std;int main(){int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };vector v(t, t+10);set s1(v.begin(),v.end());s1.insert(v.begin(),v.end());bool found = s1.find(7);if (found){cout<<"Element found!\n";}else {cout<<"…
Nội dung câu hỏi
What will happen when you attempt to compile and run the following code?#include #include #include using namespace std;int main(){int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };vector v(t, t+10);set s1(v.begin(),v.end());s1.insert(v.begin(),v.end());bool found = s1.find(7);if (found){cout<<"Element found!\n";}else {cout<<"Element not found!\n";}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 will display "Element found!"
- B. program will display "Element not found!\n"
- C. code will not compile — đáp án hiện tại
- D. changing type of variable found to int will make this code compile
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.