Question
Programming in C 3. (30 pts) Consider the following code. struct Triangle { float side1; float side2; float side3} t1, t2; enum Boolean {FALSE, TRUE};
Programming in C
3. (30 pts) Consider the following code.
struct Triangle {
float side1;
float side2;
float side3} t1, t2;
enum Boolean {FALSE, TRUE};
enum Boolean isEquilateral(struct Triangle * triangle);
a. (15 pts) Implement the function isEquilateral which returns enum value TRUE if the given triangle is equilateral and enum value FALSE otherwise. (Hint: in the real world, no two float values are exactly the same. If the difference of two float values is between -0.0001 and 0.0001, consider almostEqual and neglect the minor difference.)
b. (6 pts) Assign values of your choice to member variables of t1 to 2.5, 4.5, and 4.5, respectively.
c. (4 pts) Call the function isEquilateral on triangle t1 and capture the returned value in variable result.
d. (5 pts) Copy the content from t1 to t2 without having to individually copy each member.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started