700+ câu trắc nghiệm Ngôn ngữ lập trình C có đáp án - Phần 19

In the following code what would be the values of i1 and i2 #include <iostream> using namespace std; namespace N1 { int f(int n) { return n * 2; } } namespace N2 { int f(double n) { return n

21/25

In the following code what would be the values of i1 and i2

#include <iostream>

using namespace std; namespace N1 { int f(int n) { return n * 2; } } namespace N2 { int f(double n) { return n * 3; } } void main() { using N1::f; int i1 = f(1.0); cout << "i1 = " << i1; using N2::f; int i2 = f(1.0); cout << "i1 = " << i2; system("pause"); }

i1=2 i2=2

i1=2 i2=3

i1=3 i2=2

Error

Giải thích

Chọn đáp án B