- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- float x ,y;
- cout<<"Please type in the base of the triangle(cm): ";
- cin>>x;
- cout<<"Please type in the height of the triangle(cm): ";
- cin>>y;
- cout<<"Its base is "<<x<<"cm,and its height is "<<y<<".The area of this triangle is "<<x*y/2<<" square centimeter."<<endl;
- system("pause");
- return 0;
- }
複製代碼 |