Puzzle T28


Setting functions

Write some "set" functions for the triangle type and use them to initialize the triangle.

/* set point "num" of tri to (x, y) */
void setTriangleModPoint( TriangleMod *tri, int num, int x, int y)
{
}

/* set the color of tri to (r, g, b) */
void setTriangleModColor( TriangleMod *tri, int r, int g, int b)
{
}

int main()
{
  TriangleMod *trimod = newTriangleMod();

  /* Initialize trimod here */
  setTriangleModPoint( trimod, 0, 45, 97 );
  setTriangleModPoint( trimod, 1, 75, 80 );
  setTriangleModPoint( trimod, 2,  0,  0 );
  setTriangleModColor( trimod, 120, 240, 50);

  /* Print out trimod */
  printTriangleMod( trimod );

  /* Free memory */
  freeTriangleMod( trimod );
  
}


Answer         Next Page         Previous Page Home