返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. void hello();
  5. int myPlus(int,int,int);
  6. int main()
  7. {
  8.     hello();
  9.     cout<<myPlus(2,5,1)<<endl;
  10.     system("pause");
  11.     return 0;   
  12. }
  13. void hello()
  14. {
  15.     cout<<"HELLO!!"<<endl;
  16. }
  17. int myPlus(int x,int y,int z)
  18. {
  19.     return x+y+z;
  20. }
複製代碼

TOP

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

  4. //hello函式
  5. void hello(){
  6.         cout<<"這是hello函式"<<endl;
  7. }
  8. //宣告變數->變數型態 變數名字
  9. //int a
  10. //宣告函式->回傳型態 函式名字()

  11. //主函式
  12. int main(){
  13.       
  14.         cout<<"這是主函式的hello"<<endl;
  15.         hello();
  16.         system("pause");
  17.         return 0;
  18. }
複製代碼

TOP

返回列表