在C ++中三角形区域显示零吗?为什么?

问题描述

三角形的区域在输出中显示为零,为什么呢?
我做错了什么??

#include <iostream>
using namespace std;

int main() {
  int Base,Height,Area;

  // >>> Is anything wrong with the formula??
  Area = (0.5) * Height * Base;

  cout << "To find the Area of Triangle" << endl << endl;

  // Base
  cout << "Enter Base length:";
  cin >> Base;
  cout << endl;

  // Height
  cout << "Enter Height length";
  cin >> Height;
  cout << endl << endl;

  cout << "Your Base Length is:" << Base << endl;
  cout << "Your Height Length is:" << Height << endl;

  // calculating area of triangle

  // >>> This is the part output is zero
  cout << "Area of the triangle is :" << Area << endl;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)