#include <iostream>
int main()
{
std::cout << "Hello Heron!\n";
return 0;
}
其中跟C語言不同的地方有:- 輸入輸出標頭檔,"iostream"(input/output stream,非沒有C語言中的.h檔)
- std::是一個namespce(命名空間),被定義在"iostream",std為standard的意思,包含了
- cout:輸出
- cin :出入
- cerr:處理錯誤
- << 運算子表示把右邊運算元插入(insert)到左邊的stream,如上面程式中,把右邊的字串放入到基本輸出(std::cout)
No comments:
Post a Comment