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

TOP

返回列表