Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

im trying to get the program to run again if the user wants it to but it just asks the question, stores a response and

im trying to get the program to run again if the user wants it to but it just asks the question, stores a response and ends the program

image text in transcribed

#include //header containing cout and cin #include #include using namespace std; //introduces namespace std needed to use cout and cin int main () { // Prompt user to enter the side lengths of the triangle double a, b, c; cout > a >> b >> c ; double AngleA, cosAngleA, AngleB, cosAngleB, AngleC, area, sp; // declare variables for option 1 // calculate Angle A cosAngleA = (pow(b,2) + pow(c,2) - pow(a,2))/(2*b*c); AngleA = acos(cosAngleA)*180/3.141592; // calculate Angle B cosAngleB = (pow(c,2) + pow(a,2) - pow(b,2))/(2*c*a); AngleB = acos(cosAngleB)*180/3.141592; AngleC = 180-AngleA-AngleB; // calculate Semi-Perimeter sp = (1.0/2.0)*(a+b+c); // calculate area area = sqrt(sp*(sp-a)*(sp-b)*(sp-c)); double LargestIncircleRadius, interiorAreaT, PI; // declare variables for option 2 PI = 3.1415; // calculate the largest incircle radius LargestIncircleRadius = (2.0*area)/(a+b+c); // calculate the remaining interior area of the triangle interiorAreaT = area-(PI*(pow(LargestIncircleRadius,2))); double circumcircleRadius, interiorAreaC; // declare variables for option 3 // calculate circumcircle radius circumcircleRadius = (a*b*c)/(sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c))); // calculate the area outside of the triangle but inside circle interiorAreaC = PI * pow(circumcircleRadius,2) - area; int option = 0; // prompt user to chose which program to run cout > option; // store value for option char again = 'Y'; do {

while (option!=1 && option!=2 && option !=3) // ask user to re-enter an option if they dont enter a 1, 2, or 3. { cout > option; } switch (option) { case 1: // output the 3 angles of a triangle and the triangle area if (a>0 && b>0 && c>0 && a> again; } else cout > again; break; case 3: // compute the circumcircle radius and the remaining interior area of the circumcircle cout > again; break; default: cout =include slostrean' //heoder contoining cout and cin aincluide a,b,cj cout &4 " Please enter the length of sides n,b, and c of the triangle: " \&c end1; cin 33 a b b 33<.1 double anglea cosangled angleb coshangleb anglec area spj dectare variabtes for aption cosinglea="(pon(b,2)+pon(c,2)pon(3,2))/(2bc)3" acos cosangle0="(pon(c,2)+pou(s,2)pon(b,2))/(24c+s);" j calculate semi-perimetar. sp="(1,e/2,e)+(ab+c))" a areo acea="sqet(sp(spa)(spb)(spc))s" largestinelirslefiadius interiorareat pi declare vartables aptiani y colculate the targest incincte radius lafgestincirclefadius="(2.e+area" z calculote remoining interior aneo of triangle. inteeleedeeat="area-" posichargestincirclekidius circuectircleaidius interiorareac deetare yartoblen optfon circuncincle nadius circuncirclehadius="(abc)/(" rart caleulate anea eutside triangle but inside cirele intertordreac="PI" pow areas int option="aj" i prospt user to chose which program rum cout s endll ee="ce" endik select progran you would like run: is endl es e end ib re find angles and area. largest incircle renaining ce cincuncincle rewaining circuncircle. c op optienf stone watee aptlon. char again . do is. imaisa entiy please enter or cinse option: udtch q aleplor side lengthes angien arne if ie. entprecinion eres trianglo it te aras embil. chn agalas terakj ondiy tin acoins tricak rin mother eption with sene sides trimgle r af w endil cin ss againz break defaule: entrys ester st onsty o agbln="+Yr)j" return>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago