- #include <iostream>
- using namespace std;
- int main()
- {
- float x,y,z;
- cout<<"歡迎進入炫宗的梯形面積計算程式"<<endl;
- cout<<"請輸入上底(cm)"<<endl;
- cin>>x;
- cout<<"請輸入下底(cm)"<<endl;
- cin>>y;
- cout<<"請輸入高(cm)"<<endl;
- cin>>z;
- cout<<"您輸入的上底是"<<x<<endl;
- cout<<"您輸入的下底是"<<y<<endl;
- cout<<"您輸入的高是"<<z<<endl;
-
-
- cout<<"答案是..."<<endl;
- cout<<"("<<x<<"+"<<y<<")"<<"*"<<z<<"/2="<<(x+y)*z/2<<endl;
- system("pause");
- return 0;
- }
複製代碼 |