Need help with calculations | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Need help with calculations

This part of my code has to find out the spike base, spike height, chord length, perimeter, and area of a star polygon when the user inputs the edge length and inner angle. Here is how my code looks like https://code.sololearn.com/cgfBBd1sy85r in the example that my code is suppose to match, when you input 45 for both the inner angle and the edge length I'm suppose to get... Calculations for a Threestar Polygon Edge Length: 45.00 Outer angle: 165.00 Inner angle: 45.00 ------------------------------------ Spike base: 34.44 Spike height: 41.57 Chord length: 89.23 Height: 77.28 Perimeter: 270.00 Area: 2661.48 also what do I include so that the values are displayed with two decimal points?

20th Feb 2020, 4:39 AM
Ash
Ash - avatar
1 Answer
0
If am understood correctly, then I say read about setprecision methods .... put this, line before outputting spike Bike. cout << fixed << setprecision(2) << spikeBase << endl;
20th Feb 2020, 7:31 AM
Jayakrishna 🇮🇳