#本章內容包括:
- 創建C++程序
- C++程序的一般格式
- #include編譯指令
- main函數
- 使用cout對象進行輸出
- 在C++程序中加入註釋
- 何時以及如何使用endl
- 聲明和使用變量
- 使用cin對象進行輸入
- 定義和使用簡單函數
程序1.1 myfirst.cpp
//myfirst.cpp – display a message
#include<iostream> //a preprocessor directive預處理命令
using namespace std; //make definitions visble
int main() //主函數
{
cout << "Hello word!" << endl; //message endll instead of\n
return 0;
}