33 lines
593 B
C
33 lines
593 B
C
|
#include <stdio.h>
|
||
|
|
||
|
// TODO: Implement the position struct
|
||
|
typedef struct position
|
||
|
{
|
||
|
}position;
|
||
|
|
||
|
struct circle {
|
||
|
position pos;
|
||
|
float diameter;
|
||
|
};
|
||
|
|
||
|
// As with enums you can use typedef to avoid writing struct everywhere
|
||
|
typedef struct circle Circle;
|
||
|
|
||
|
// TODO: Finish this function
|
||
|
void PrintPos(Circle cir)
|
||
|
{
|
||
|
printf("The circle is at position (%4.2f,%4.2f).\n", 0,0);
|
||
|
}
|
||
|
|
||
|
int main(int argc, const char *argv[])
|
||
|
{
|
||
|
// TODO: Set the position to x = 4.5 and y = 2.0
|
||
|
position CirclePos;
|
||
|
Circle my_circle;
|
||
|
my_circle.pos = CirclePos;
|
||
|
my_circle.diameter = 2;
|
||
|
|
||
|
PrintPos(my_circle);
|
||
|
return 0;
|
||
|
}
|