C++命名空间
//#include "Program.h" #include <iostream> namespace Name { using namespace std; void ShowMsg(char msg[]) { //cout<<msg<<endl; cout<<msg<<endl; } } int main() { using namespace std; /*using namespace Name; ShowMsg("chinese");*/ Name::ShowMsg("chinese"); int score=100; const int *pScore=&score;//不能通过*pScore更改score的数值 int newScore = 300; pScore=&newScore; //*pScore=300; score=200; cout<<score<<endl;//输出200; cout<<*pScore<<endl;//输出300; int result; cin>>result; return 0; }