/* #include<iostream>
#:預處理標志,后面跟預處理指令,include:預處理指令,包含 <iostream>:c++頭文件,輸入輸出流
這行的作用就是在預編譯之前先執行這行代碼。系統提供的頭文件用<>括起來
#include<iostream.h>
這個頭文件是c標准的頭文件,c++中叫非標准庫文件。
using namespace std;使用標准命名空間。也就是說C++當中的標准庫文件,函數,對象啊等都存放在std空間中,
作用:作用是在編寫大程序的時候能夠定義重復的變量,(標識符)
當需要調用標准空間中的對象,函數的時候調用方法:std::cout std::cin std::endl;需要加雙冒號
#include<iostream> #include<iostream.h>的區別:
使用#include<iostream>的時候,需要使用using namespace std;而#include<iostream.h>不需要
*/
#include <iostream>
//using std::cout; //使用std空間中cout對象。::調用的意思
//using std::endl;
int main(void)
{
//cout<<"hello world"<<endl;
std::cout<<"hello world"<<std::endl;
return 0;
}
/*
#include<iostream>
using namespace std;
int main(void)
{
cout<<"hello world"<<endl;
return 0;
}
#include<iostream.h>
int main(void)
{
cout<<"hello world"<<endl;
return 0;
}
*/
//重命名問題
#include<iostream>
namespace a
{
int b=5;
}
namespace c
{
int b=99;
}
int main(void)
{
int b=-77;
std::cout<<b<<std::endl;
std::cout<<a::b<<std::endl;
std::cout<<c::b<<std::endl;
return 0;
}