返回列表 發帖
  1. #include<iostream>  //標頭檔
  2. #include<cstdlib>   //標頭檔
  3. using namespace std;  //命名空間
  4. int main() //主函式
  5. {
  6.      cout<<"快樂c++"<<endl;
  7.      system("pause");     
  8.      return 0;
  9. }
複製代碼

TOP

  1. #include<iostream>  //引入標頭檔 <基本輸入輸出> in & out stream
  2. #include<cstdlib>   //引入標頭檔 <基本函式庫> c standard library
  3. using namespace std;  //使用命名空間 std
  4. int main() //主函式
  5. {
  6.         string name="蔡季樺",school="福東國小";
  7.         int age=11;
  8.         float height=150.2,weight=40.3;
  9.         cout<<"我的大名:"<<name<<endl;
  10.         cout<<"就讀:"<<school<<endl;
  11.         cout<<"今年"<<age<<"歲"<<endl;
  12.     cout<<"身高"<<height<<"公分"<<endl;
  13.     cout<<"體重"<<weight<<"公斤"<<endl;
  14.     system("pause");  //暫停
  15.     return 0;         //回傳0到主控台告訴電腦,程式已成功執行
  16. }
複製代碼

TOP

  1. #include<iostream>  //引入標頭檔 <基本輸入輸出> in & out stream
  2. #include<cstdlib>   //引入標頭檔 <基本函式庫> c standard library
  3. using namespace std;  //使用命名空間 std
  4. int main() //主函式
  5. {
  6.        
  7.         int x=1,y=1;
  8.         cout<<"當y的值為"<<y<<",x的值為"<<x<<"時"<<endl;
  9.         cout<<"y+x"<<x+y<<endl;

  10.     system("pause");  //暫停
  11.     return 0;         //回傳0到主控台告訴電腦,程式已成功執行
  12. }
複製代碼

TOP

返回列表