/*
 一次関数を描くグラフ 473088 榎田裕一郎
*/

#include <stdio.h>
#include <math.h>
#include <eggx.h>

int main() {
  int x, win;
  float y, a, b;

  win=gopen(400,400);  /* 描画ウィンドウを開く */
  winname(win, "sample 1"); /* 名前をつける */

  newpen(win, 1);
  line(win, 5.0, 200.0, PENUP);
  line(win, 395.0, 200.0, PENDOWN);
  line(win, 200.0, 5.0, PENUP);
  line(win, 200.0, 395.0, PENDOWN);

  a=0.3;
  b=20.0;
  newpen(win, 2);
  for(x=-190; x<190; x++) {
    y=a * x + b;
    pset(win, x + 200.0, y + 200.0);
  }

  ggetch(win); /* キー入力を待つ */
  gclose(win); /* 描画ウィンドウを閉じる */

  return 0;
}

