geometry items | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

geometry items

Complete this stub of a geometry program without editing the existing stub content. Ex1: Input Format: 6 Line 0.739 0.053 0.380 0.383 Line 0.098 0.158 0.546 0.531 Square 0.120 0.707 0.346 Rectangle 0.769 0.041 0.995 0.859 Rectangle 0.671 0.520 0.246 0.226 Square 0.333 0.721 0.249 Output Format: 6 geometric items Line from (0.739000, 0.053000) to (0.380000, 0.383000) Line from (0.098000, 0.158000) to (0.546000, 0.531000) Square with corner at (0.120000, 0.707000) and side 0.346000 Rectangle with corner at (0.769000, 0.041000) with width 0.995000 and height 0.859000 Rectangle with corner at (0.671000, 0.520000) with width 0.246000 and height 0.226000 Square with corner at (0.333000, 0.721000) and side 0.249000 Ex2: Input Format: 6 Rectangle 0.692 0.895 0.016 0.515 Square 0.188 0.818 0.133 Line 0.611 0.579 0.886 0.260 Circle 0.797 0.366 0.080 Circle 0.960 0.170 0.373 Circle 0.480 0.694 0.339 Output Format: 6 geometric items Rectangle with corner at (0.692000, 0.895000) with width 0.016000 and height 0.515000 Square with corner at (0.188000, 0.818000) and side 0.133000 Line from (0.611000, 0.579000) to (0.886000, 0.260000) Circle with center at 0.797000, 0.366000 and radius 0.080000 Circle with center at 0.960000, 0.170000 and radius 0.373000 Circle with center at 0.480000, 0.694000 and radius 0.339000 Stub: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> struct Geometry; void initRectangle(struct Geometry **object); void initSquare(struct Geometry **object); void initCircle(struct Geometry **object); void initLine(struct Geometry **object); void printGeometry(struct Geometry* object); void freeGeometry(struct Geometry* object); #define SCANF_FMT_CIRCLE "%f %f %f" #define SCANF_FMT_RECTANGLE "%f %f %f %f" #define SCANF_FMT_SQUARE "%f %f %f" #define SCANF_FMT_LINE "%f %f %f %f" #define PRINTF_FMT_CIRCLE "Circle with center at %f, %f and radius %f\n" #define PRINTF_FMT_RECTANGLE "Rectangle with corner at (%f, %f) wi

22nd Oct 2022, 9:07 AM
harsha vardhan
harsha vardhan - avatar
2 Answers
+ 4
The code is cuted and incomplete. Please save your code in Sololearns Playground and link here. Let us know what is your question?
22nd Oct 2022, 11:05 AM
JaScript
JaScript - avatar
0
What is next step to complete the program
6th Jun 2023, 11:10 AM
Amitha G
Amitha G - avatar