In the following struct use a function pointer to switch to print each of draw functions based
No answer yet for this question.
Ask a Tutor
Question:
- In the following struct use a function pointer to switch to print each of draw functions based on the input for circle, rectangle and triangle respectively
struct GeoObject {
enum {CIR=0, REC, TRG} gCode;
union {
struct Cir { double x, y, r; }c;
struct Rec { double x, y, w, h; }r;
struct Trg { double x, y, b, h; }t;
};
};
void drawCir(struct GeoObject);
void drawRec(struct GeoObject);
void drawTrg(struct GeoObject);
Posted Date: