#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "GrWin.h"

/* 入力した指示によって処理を変える */

int main()
{
  float x, y, size;
  int xx, yy, c, type;

  printf("drawing type (1-2) and size = ");
  scanf("%d %f", &type, &size);

  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++) { 
      if( type == 1 ) {
        /* 塗りつぶした四角形 */
        GWsrect(x, y, x+size, y+size, c);
      } else if( type == 2 ) {
        /* 塗りつぶした円 */
        GWscircle(x, y, x+size, y+size, c);
      } else {
        printf(" 1 か 2 で指定してください\n");
        GWquitx(0);
        return 0;
      };
      x=x+20.0;
      c++;
      if( c == 19 ) {
        c=0; /* 白(19)は使わず黒(0)に戻す */
      };
    };
    y=y+20.0;
  };

  return 0;
}

