//cad.c

//Instead of a list of variables like:
//
//int lengthofrectangle1 = 10;
//int heightofrectangle1 = 2;
//int positionxofrectangle1 = 0;
//int positionyofrectangle1 = 0;
//int lengthofrectangle2 = 4;
//int heightofrectangle2 = 3;
//int positionxofrectangle2 = 0;
//int positionyofrectangle2 = 0;
//
//we can group them together by creating a rectangle "object".

struct rectangle {
  int height;
  int length;
  int positionx;
  int positiony;
  int number;};

//We can then initialize them with

//  struct rectangle rectangle1;
//  struct rectangle rectangle2;
//  rectangle1.height = 10;
//  rectangle1.length = 2;
//  rectangle1.positionx = 0;
//  rectangle1.positiony = 0;
//  rectangle1.number = 1;
//  rectangle2.height = 4;
//  rectangle2.length = 3;
//  rectangle2.positionx = 0;
//  rectangle2.positiony = 0;
//  rectangle2.number = 2;
//
//  print_rectangle_properties(rectangle1);
//  print_rectangle_properties(rectangle2);}

//then pass the entire rectangle to a procedure:

void print_rectangle_properties ( struct rectangle rec) {
  printf("height of rectangle%d is %d\n", rec.number, rec.height);
  printf("length of rectangle%d is %d\n", rec.number, rec.length);
  printf("xposition of rectangle%d is %d\n", rec.number, rec.positionx);
  printf("yposition of rectangle%d is %d\n", rec.number, rec.positiony);}


//Now whenever we need to print a rectangle, we can just use
//print_rectangle_properties(rectangle1);
//this continues to work for new rectangles we define later in the program.



//we can similarly create circles for our cad system.

// circle stuff
struct circle {
  int radius;
  int positionx;
  int positiony;
  int number;};

void print_circle_properties (struct circle cir) {
        printf("radius of circle%d is %d\n", cir.number, cir.radius);
        printf("xposition of circle%d is %d\n", cir.number, cir.positionx);
        printf("yposition of circle%d is %d\n", cir.number, cir.positiony);}


int main(){
  struct rectangle rectangle1;
  struct rectangle rectangle2;
  struct circle circle1;
  struct circle circle2;

  rectangle1.height = 10;
  rectangle1.length = 2;
  rectangle1.positionx = 0;
  rectangle1.positiony = 0;
  rectangle1.number = 1;
  rectangle2.height = 4;
  rectangle2.length = 3;
  rectangle2.positionx = 0;
  rectangle2.positiony = 0;
  rectangle2.number = 2;

  print_rectangle_properties(rectangle1);
  print_rectangle_properties(rectangle2);

  circle1.radius = 10;
  circle1.positionx = 0;
  circle1.positiony = 0;
  circle1.number = 1;
  circle2.radius = 4;
  circle2.positionx = 0;
  circle2.positiony = 0;
  circle2.number = 2;

  print_circle_properties(circle1);
  print_circle_properties(circle2);
}


