返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. float tri(float,float);
  5. int main()
  6. {
  7.     float x, y;
  8.     tri(x,y);
  9.     system("pause");
  10.     return 0;
  11. }
  12. float tri(float a, float b)
  13.     cout<<"請輸入三角形的底(公分): ";
  14.     cin>>a;
  15.     cout<<"請輸入三角形的高(公分): ";
  16.     cin>>b;
  17.     cout<<"三角形的面積為"<<a*b/2<<"平方公分!"<<endl;
  18. }
複製代碼

TOP

返回列表