返回列表 發帖

第一支程式

在執行窗格中顯示 "快樂C++" 字樣
  1. #include<iostream>      //input & output
  2. #include<cstdlib>       //standard liburary
  3. using namespace std;
  4. int main()      //主函式
  5. {
  6.     cout<<"快樂C++ "<<endl;
  7.     system("pause");
  8.     return 0;    //回傳0 告訴電腦本程式已成功結束
  9. }
複製代碼

  1. #include<iostream>  //input & output <基本輸入輸出>
  2. #include<cstdlib>   //c standard library <標準函示庫>
  3. using namespace std;  //指定命名空間為 std
  4. int main()   //主函式
  5. {
  6.     cout<<"快樂C++"<<endl;
  7.     system("pause");
  8.     return 0;    //回傳0至主控台 回報程式已成功執行
  9. }
  10. /*
  11. int add(int a,int b)
  12. {
  13.     return a+b;   
  14. }

  15. add(5,3)  ---> 8
  16. */
複製代碼

TOP

返回列表