求問大神,為什么輸出錯誤?
#include <iostream>?
#include<stdlib.h>
using namespace std;
namespace A
{int x=1;
?void fun()
?{
cout<<"A"<<endl;
?}
?void funn()
?{
cout<<"2A"<<endl;
?}
}
?namespace B
?{
? ?int x;
? ?void funn()
? ?{
? cout<<"woai"<<endl;
? ? }
? ?void fun()
? ?{
? cout<<"888"<<endl;
? ?}
?}
int main(void)
{
cout<<A::x<<endl;
cout<<A::fun<<endl;
cout<<B::funn<<endl;
cout<<B::fun<<endl;
system("pause");
return 0;
}
答案顯示出來是圖片上的
實際上應該是
?1???A??woai?????888
2017-11-03
cout<<A::x<<endl;
A::fun();
B::funn();
B::fun();