返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int calcu(int,int);
  5. int calcu(int,int,int);
  6. int main()
  7. {
  8.     int x, y, z;
  9.     cout<<"請依序輸入任意三個數: ";
  10.     cin>>x;
  11.     cin>>y;
  12.     cin>>z;
  13.     cout<<"前兩數相加的值為"<<calcu(x,y)<<endl;
  14.     cout<<"三數相加的值為"<<calcu(x,y,z)<<endl;
  15.     system("pause");   
  16.     return 0;
  17. }
  18. int calcu(int x,int y)
  19. {
  20.     return x+y;   
  21. }
  22. int calcu(int x,int y,int z)
  23. {
  24.     return x+y+z;   
  25. }
複製代碼

TOP

返回列表