Pentagon Project in c++

扶醉桌前 提交于 2019-12-02 13:03:09

I take it that you're just confused about translating math syntax into code.

Your equation for area:

s^2*sqrt(25+10(sqrt(5)))/4

Goes like this in C++:

double area = s * s * sqrt(25.0 + 10.0 * sqrt(5.0)) / 4.0;

After that, you have an error:

return area;

The ProcessCommand function is void, which means you can't return a value. It wouldn't make sense to do so anyway. Perhaps you want to output it with std::cout instead.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!