icp/oer/courses/c-basics/sections/12-struct_enum/04-circle/program.c

53 lines
873 B
C

#include <stdio.h>
#include <stdlib.h>
#define Square(x) ((x)*(x))
// TODO: Define your result enum
typedef enum result_enum
{
RESULT_NONE,
}result_enum;
typedef struct position
{
float x;
float y;
}position;
typedef struct circle
{
position pos;
int radius;
}circle;
result_enum inside(circle c, position p)
{
// TODO: Implement this function
return RESULT_NONE;
}
int main(int argc, const char *argv[])
{
if(argc != 3)
{
printf("Wrong number of Arguments!");
return 1;
}
float x = atoi(argv[1]);
float y = atoi(argv[2]);
postion TestPoint = {x,y};
psotion CircleCenter = {5,3};
circle Circle = {CircleCenter, 6};
if(inside(Circle, TestPoint)==RESULT_NONE) // TODO: Check for your result enum
{
printf("Point (%f, %f) is Inside the Circle.\n", x,y);
}
else
{
printf("Point (%f, %f) is not Inside the Circle.\n",x,y);
}
return 0;
}