按照老師的方法怎么不行???幫我看看唄
#include?<iostream>
#include?<stdlib.h>
using?namespace?std;
namespace?A
{
void?fun()
{
cout<<"I"<<endl;
}
}
namespace?B
{
void?fun2()
{
cout<<"Love"<<endl;
}
}
namespace?C
{
void?fun3()
{
cout<<"You"<<endl;
}
}
int?main()
{
cout<<A::fun<<endl;
B::fun2;
C::fun3;
system("pause");
return?0?;
}為毛不是顯示 I Love You ? ?運行之后顯示
2015-10-07
cout<<A::fun<<endl輸出的是fun()方法的返回值,而fun還是void無返回值應寫為A::fun();我也是新學習C++,你看對不?
2015-07-26
#include <iostream>
#include <stdlib.h>
using namespace std;
namespace A
{
void fun()
{
cout << "I" << endl;
}
}
namespace B
{
void fun2()
{
cout << "Love" << endl;
}
}
namespace C
{
void fun3()
{
cout << "You" << endl;
}
}
int main()
{
A::fun ();
B::fun2();
C::fun3();
system("pause");
return 0;
}
2015-07-23