返回列表 發帖

我的第一支程式

本帖最後由 鄭繼威 於 2022-7-16 14:19 編輯

在螢幕上顯示 hello 字樣.
  1. #include<iostream>     //引入 <基本輸入輸出> 標頭檔 input & output stream
  2. #include<cstdlib>      //引入 <標準函式庫> 標頭檔 c standard library
  3. using namespace std;   //指定命名空間為 std
  4. int main()    //主函式
  5. {
  6.     //你要做的事
  7.     cout<<"hello"<<endl;   //cout輸出  endl換行
  8.     system("pause");       //讓畫面暫停
  9.     return 0;              //回傳0到主控台,告知該程式已成功執行
  10. }
複製代碼
//        ()小括號
//        []中括號
//        {}大括號

  1. code
複製代碼
[code][/code]

TOP

  1. #include<iostream>  //引入基本輸入輸出函式庫 input&output stream
  2. #include<cstdlib>   //引入C標準函式庫 C standard libary
  3. using namespace std;                  //指定命名空間為std
  4. //主函式/主程式
  5. int main()
  6. {
  7.    
  8.     //註解->給人看
  9.     //你要做的事
  10.     cout<<"hello"<<endl;        //cout->輸出 <<串接符號 endl->結束並換行
  11.      
  12.     system("pause");                  //system->系統,pause->暫停
  13.     return 0;                         //return->回傳,告知主程式已經完成
  14. }
複製代碼

TOP

本帖最後由 林劭杰 於 2022-3-14 20:29 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     cout<<"hallo world"<<endl;
  7.     system("pause");
  8.     return 0;
  9. }
複製代碼

TOP

本帖最後由 林劭澧 於 2022-3-14 20:25 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(  )
  5. {
  6.     cout<<"hello world"<<endl;
  7.     system("pause");
  8.     return 0;
  9. }         
複製代碼

TOP

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     cout<<"hello"<<endl;
  6.     system("pause");
  7.     return 0;
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     cout<<"hello"<<endl;
  7.     system("pause");
  8.     return 0;
  9. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.   cout<<"hello"<<endl;   
  7.   system("pause");
  8.   return 0;
  9. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     cout<<"hello"<<endl;   
  7.     system("pause");
  8.     return 0;
  9. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     cout<<"hello"<<endl;
  7.     system("pause");
  8.     return 0;
  9. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     cout<<"hello world"<<endl;
  7.     system("pause");
  8.     return 0;
  9. }
複製代碼

TOP

  1. #include<iostream>  //基本輸入輸出函式庫
  2. #include<cstdlib>   //c 標準函式庫
  3. using namespace std;    //指定命名空間為std

  4. int main()
  5. {
  6.     cout<<"hello"<<endl;  //cout 輸出  <<串接符號  endl= end line 換行
  7.     system("pause");      //讓黑色畫面暫停
  8.     return 0;
  9. }
複製代碼

TOP

返回列表