Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i am having trouble figuring out... The program runs, but terminates after asking for the three sides (returns a message that Sum of 2 sides

i am having trouble figuring out... The program runs, but terminates after asking for the three sides (returns a message that "Sum of 2 sides must be less..."). The program never gets to carry out the "switch" ... PLEASE SEE FAULTY CODE BELOW... Need help figuring out why the program doesnt carry all the way out through the switch function, etc...

#include #include // for using M_PI (value of pi) #include // for using inverse trignometric functions using namespace std; void angle(float a,float b, float c) { /*****using cosine formula we can easily calculate the angles of each vertex*****/ cout<<"The angles are : "; cout<<(float)acos((b*b + c*c - a*a)/(2*b*c))*180/M_PI<<"\370"; // \370 is used for the degree sign // cout<<", "; cout<<(float)acos((b*b + a*a - c*c)/(2*b*a))*180/M_PI<<"\370"; cout<<", "; cout<<(float)acos((a*a + c*c - b*b)/(2*a*c))*180/M_PI<<"\370 "; float s = (a+b+c)/2; cout<<"Area of triangle = "<>a>>b>>c; if(a<0 || b<0 c<0) { cout<<"negative value for side not allowed."; return 1; } else if(a+b return 1; } cout<<"1.Find the angles. "; cout<<"2.Radius of incircle & remaining area of triangle. "; cout<<"3.Radius of circumcircle % remaining area of circle. "; cout<<"Enter your choice : "; int ch; cin>>ch; switch(ch) { case 1: angle(a,b,c); break; case 2: incircle(a,b,c); break; case 3: circumcircle(a,b,c); break; default : break; } }

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

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions