cardioid.c

来自「Many C samples. It is a good sample for 」· C语言 代码 · 共 32 行

C
32
字号
/* Bai tap 2_7 - Chuong trinh ve duong Cardioid */
#include <conio.h>
#include <graphics.h>
#include <math.h>

#define K 150

void cardioid()
{
   double goc = 0.0;
   double f, xc, yc;

   xc = getmaxx() / 2;
   yc = getmaxy() / 2;
   while (!kbhit())
   {
      f = K * (1 + cos(goc));
      putpixel(xc + f * cos(goc), yc + f * sin(goc), YELLOW);
      goc += 0.01;
   }
}

void main()
{
  int gr_drive = DETECT, gr_mode;

  initgraph(&gr_drive, &gr_mode, "");
  cardioid();

  getch();
  closegraph();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?