用C语言或者C++编程

根据父母的身高可预测子女成年后的遗传身高,其预测公式如下:男性成人时身高=(父亲身高+母亲身高)0.54cm女性成人时身高=(父亲身高0.923+母亲身高)/2cm已知男孩小明爸妈的身高分别175cm,162cm;女孩小红父母的身高分别是178cm,153cm;我的父母身高分别是175cm,165cm;编写程序计算并输出小明、小红和我(男性)的遗传身高(要求输出结果不含小数位)。


#include<iostream>
using namespace std;

int predict(int fHeight, int mHeight, bool isMale)
{
    return isMale ? (fHeight + mHeight) * 0.54 : (fHeight * 0.923 + mHeight) * 0.5;
}

int main()
{
    int xmFHeight = 175, xmMHeight = 162;
    int xhFHeight = 178, xhMHeight = 153;
    int mFHeight = 175, mMHeight = 165;

    cout << "小明的遗传身高为:" << predict(xmFHeight, xmMHeight, true) << endl;
    cout << "小红的遗传身高为:" << predict(xhFHeight, xhMHeight, false) << endl;
    cout << "我的遗传身高为:" << predict(mFHeight, mMHeight, true) << endl;
    
    return 0;
}

不知道需不需要进行四舍五入,目前程序采用强制类型转换,直接去掉了小数点之后的数字。