返回列表 發帖
#include<iostream>
using namespace std;

int main()

{

    float x, y;

    cout<<"<三角形面積面積計算機>"<<endl;

    cout<<"請輸入三角形的底(公分): ";

    cin>>x;

    cout<<"請輸入三角形的高(公分): ";

    cin>>y;

    cout<<"底為"<<x<<"公分,高為"<<y<<"公分的三角形,面積為"<<

          (x*y)/2<<"平方公分"<<endl;

    system("pause");

    return 0;   

}

TOP

#include<iostream>
using namespace std;

int main()

{

    float x, y, z;

    cout<<"梯形面積計算機"<<endl;

    cout<<"請輸入上底(公分):";
   
    cin>>x;

    cout<<endl;
   
    cout<<"請輸入下底(公分):";
   
    cin>>y;
   
    cout<<endl;
   
    cout<<"請輸入高(公分):";
   
    cin>>z;
   
    cout<<endl;
   
    cout<<"梯形面積為"<<(x+y)*z/2<<"平方公分";
   
    system("pause");

    return 0;   

}

TOP

返回列表