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

TOP

返回列表