![]() |
C++ |
一、CPP(C++) 開發工具:
本例使用工具:Notepad++
參考:如何在Notepad++編譯 c & c++ 語言
其它工具:Dev-C++
二、基本C++語言程式
#include
#include
using namespace std;
int main(void)
{
string str("Hello! World!");
cout << endl;
cout << str << endl;
return 0;
}
三、基本格式說明:
註解方式:
多行註解: /*
這裡面是註解
*/
單行註解://這後面是註解,不可換行。
程式說明:
#include
// 引入標準程式庫中的字串相關的程式
#include
// std 為標準程式庫的名稱空間
using namespace std;
int main(void)
{
// 建立變數名稱為 str , 資料型態為 string 物件
// str 括弧是 string 的建構子
// str("存放文字")
string str("Hello! World!");
// 使用 cout 輸出資料
// 使用 ENDL 為換行符號 \n
cout << endl;
cout << str << endl;
return 0;
}
三、程式執行
圖1:
相關參考:
[C]C語言_基本格式(Hello! World!)
- 首頁
- JAVA 目錄
- JAVA WEB 目錄
- JAVA 其他未分類 目錄
- Grails目錄
- jQuery 目錄
- Apache 目錄
- JavaScript 目錄
- Spring + Hibernate 目錄
- Hibernate 目錄
- Linux 目錄
- 程式開發工具目錄
- MySQL 目錄
- PHP目錄
- C/C++ 目錄
- Google App Engine 目錄
- HTML5/CSS3
- 程式開發基本資訊
- Android
- Oracle 目錄
- Struts 目錄