#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "GrWin.h"

/* if によって色を変える */

int main()
{
  float x, y;
  int xx, yy, c;

  GWopen(0);
  GWindow(0.0, 0.0, 200.0, 200.0);

  c=0; /* 最初の色 (0:黒) */
  y=20.0; /* 最初の下端の位置 */
  for(yy=1; yy<=8; yy++) {
    x=10.0; /* 左端の位置 */
    for(xx=1; xx<=8; xx++) { 
      GWsrect(x, y, x+10.0, y+10.0, c);
      x=x+20.0;
      c++;
      if( c == 19 ) {
        c=0; /* 白(19)は使わず黒(0)に戻す */
      };
    };
    y=y+20.0;
  };

  return 0;
}

