返回列表 發帖
本帖最後由 曲書辰 於 2019-7-6 14:44 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<cmath>
  4. using namespace std;
  5. float tri(float,float);
  6. int main()
  7. {
  8.   int a,b;
  9.   cout<<"輸入三角形的底和高:";
  10.   cin>>a;
  11.   cin>>b;
  12.   cout<<tri(a,b)<<endl;
  13.   system("pause");  
  14.   return 0;  
  15. }
  16. float tri(float a , float b )
  17.   {
  18.         return a*b/2;
  19.   }
複製代碼

TOP

返回列表