单选题:What will be the output of the following C++ code?
What will be the output of the following C++ code?
Content of header file h1.h
------------------------------------------------
//h1.h
#include <iostream.h>
using namespace std;
namespace A
{
int func(int a)
{
cout<<"using namespace A";
return 2*a;
}
}
------------------------------------------------
Content of header file h2.h
------------------------------------------------
//h2.h
#include <iostream.h>
using namespace std;
namespace B
{
float func(float a)
{
cout<<"using namespace B";
return 2*a;
}
}
------------------------------------------------
Content of program.cpp
------------------------------------------------
#include <iostream.h>
#include <string.h>
#include "h1.h"
#include "h2.h"
using namespace std;
using namespace A;
using namespace B;
int main(int argc, char const *argv[])
{
/* code */
int a = 10;
float b = 10.0;
cout<<A::func(a)<<endl;
cout<<A::func(b);
return 0;
}
------------------------------------------------
A.using namespace A20
using namespace B20
B.using namespace A20
using namespace A20
C.using namespace A10
using namespace A10
D.using namespace A10
using namespace B10
答案:B
Content of header file h1.h
------------------------------------------------
//h1.h
#include <iostream.h>
using namespace std;
namespace A
{
int func(int a)
{
cout<<"using namespace A";
return 2*a;
}
}
------------------------------------------------
Content of header file h2.h
------------------------------------------------
//h2.h
#include <iostream.h>
using namespace std;
namespace B
{
float func(float a)
{
cout<<"using namespace B";
return 2*a;
}
}
------------------------------------------------
Content of program.cpp
------------------------------------------------
#include <iostream.h>
#include <string.h>
#include "h1.h"
#include "h2.h"
using namespace std;
using namespace A;
using namespace B;
int main(int argc, char const *argv[])
{
/* code */
int a = 10;
float b = 10.0;
cout<<A::func(a)<<endl;
cout<<A::func(b);
return 0;
}
------------------------------------------------
A.using namespace A20
using namespace B20
B.using namespace A20
using namespace A20
C.using namespace A10
using namespace A10
D.using namespace A10
using namespace B10
答案:B