Pentagon Project in c++

前端 未结 1 866
梦毁少年i
梦毁少年i 2021-01-26 13:05

Soo.. I\'m writing a pentagon project for my c++ class, and to be honest I\'m not really doing well right now due job and other classes. So.. we need to make a pentagon program

相关标签:
1条回答
  • 2021-01-26 13:29

    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.

    0 讨论(0)
提交回复
热议问题