標題:
面積計算 (一) - 三角形
[打印本頁]
作者:
tonyh
時間:
2018-7-11 14:46
標題:
面積計算 (一) - 三角形
本帖最後由 tonyh 於 2018-7-11 15:18 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main() //主函式
{
float a,b; //int --> integer
cout<<"三角形的底(公分): ";
cin>>a;
cout<<"三角形的高(公分): ";
cin>>b;
cout<<"底"<<a<<"公分,高"<<b<<"公分的三角形,面積為"<<a*b/2<<"平方公分."<<endl;
system("pause");
return 0;
}
複製代碼
作者:
古蕾娜
時間:
2018-7-11 15:08
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
float a,b;
cout<<"the area triangle's bottom (cm): ";
cin>>a;
cout<<"the area triangle's height (cm): ";
cin>>b;
cout<<"bottom"<<a<<"cm, height"<<b<<"cm of the triangle, the area is"<<a*b/2<<"sqaure."<<endl;
system("pause");
return 0;
}
複製代碼
作者:
古昇暘
時間:
2018-7-11 15:21
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
float a,b;
cout<<"the base of the traingle(cm): ";
cin>>a;
cout<<"the height of the traingle(cm): ";
cin>>b;
cout<<" the base is "<<a<<" and the height is "<<b<<" so the area is "<<a*b/2<<" centemiter square "<<endl;
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2