#define CRT SECURE NO WARNINGS #include : scanf %c\", cmd) switch (cmd) Add rect
ID: 3779089 • Letter: #
Question
#define CRT SECURE NO WARNINGS #include : scanf %c", cmd) switch (cmd) Add rectangle case 'A' case 'a' if (nRect 10) List is full. printf ("No room in list of rectangles "): else printf ("Enter coordinates as x y starting with lower left hand corner: n") readPoint (&rlistlnRect; vert[0]) read Point (&rlistlnRect; J. vert[1]) read Point (&rlistlnRect; J. vert[2]) read (&rlistlnRect; J. vert[3]) Point nRect++ break Print list case 'P': case 'p' if (nRect 0) List is empty printf ("No rectangles in list "); else print List list nRect) breakExplanation / Answer
==============================================
-------------
Answer:
-------------
The error line mentioned needs to changed from
scanf("%lf %lf",p->x, p->y);
To
scanf("%lf %lf",&p->x, &p->y);
This will fix the issue.
-------------------
Explanation:
-------------------
In Point structue x and y are of type simple double variables.
Since all the normal variables are read using '&' symbol using scanf.
Making the p->x to &p->x
and p->y to &p->y
These changes resolve the issue of reading point data from keyboard using scanf.
==============================================
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.