Professional Documents
Culture Documents
Message
Message
*/
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
// PointNode properties:
/*
int ID
struct pointNode* next
*/
typedef struct pointNode {
int ID;
struct pointNode* next;
} PointNode;
// Polygon properties:
/*
PointNode* points
int nPoints
int min, max
*/
typedef struct {
PointNode* points;
int nPoints;
int min, max;
} Polygon;
//int vertexID;
/* TODO: Read data for the vertices comprising a Polygon (build a polygon) from
standard input */
/* Read data until a negative integer is read */
printf("Enter vertices: \n");
scanf("%d", &userVertices);
while(userVertices >= 0) {
addVertexToPolygon(&polygon, pointNode.ID);
printf("Enter vertices: \n");
scanf("%d", &userVertices);
}
/* TODO: Report the Polygon's number of vertices, the specific list of vertex
indecies,
and the minimum and maximum indices in the list.
*/
displayVertexIndices(&polygon);
// for(int i = 0; i < polygon.nPoints; polygon.nPoints++) {
//
// }
//printf("This polygon has %d vertices, with indices %d,", )
/* TODO: Read data for a second set of vertices, and for each vertex ID search
the Polygon's list of vertices,
if a matching vertex ID is found, report the address of the PointNode
where the ID was found.
*/
/* Read data until a negative integer is read */
/* TODO: Make sure you free any dynamically allocated memory before the program
ends.
Use Valgrind to check, because TAs will. */
return 0;
/*
PointNode* findVertexInPolygon( Polygon polygon, int vertexID );
Return the address of the PointNode in which the vertex ID was found.
If the vertex was not found, return NULL.
*/
/*
int size( Polygon polygon );
/*
int isEmpty( Polygon polygon );
/*
int removeVertexFromPolygon( Polygon* polygon );
Removes one vertex from the Polygon from the head of the linked list,
frees up memory associated with the PointNode.