返回列表 發帖
  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. {  
  14.     cout<<"請輸入三角形的底: ";
  15.     cin>>a;
  16.     cout<<"請輸入三角形的高: ";
  17.     cin>>b;
  18.     cout<<"此三角形面積為: "<<a*b/2<<"平方公分!";
  19. }
複製代碼

TOP

返回列表