Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y (all floats).

image text in transcribedimage text in transcribed

1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y (all floats). Use a tag to call it Rectangle. b. Declare a variable struct type Rectangle 2. Consider the following variables: struct lint x; float y; char z;)var1 union (int x; float y; char[20] z;)var2; If float and intare stored using 4 bytes each, what is the size (in bytes) for var1? What is the size of var2? (2 pts) 3. Consider the following code. struct Triangle float side1 float side2; float side3 t1, t2; enum Boolean HFALSE, TRUE); enum Boolean isEquilateral(structTriangle triangle); a. Implement the function isEquilateral which returns enum value TRUE if the given triangle is equilateral and enum value FALSE otherwise. (2 pts) b. Assign values of your choice to member variables of t1 (1.5 pts); c. Call the function isEquilateral on triangle t1 and capture the returned value in variable result. (1 pt) d. Copy the content from t1 to t2 without having to individually copy each member. (1 pt) 4. What is the output of the following program: (1 pt) typedef struct char name[20]; int grade 1; int grade2; int finalGrade) Record

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

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

Psychological, financial, and career counseling.

Answered: 1 week ago