⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rose.c

📁 Many C samples. It is a good sample for students to learn C language.
💻 C
字号:
/* Bai tap 2_8 - Chuong trinh ve duong Hoa hong */
#include <conio.h>
#include <graphics.h>
#include <math.h>

#define K 150

void rose(int n)
{
   double goc = 0.0;
   double f, xc, yc;

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

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

  printf("\nCho biet so canh hoa : ");
  scanf("%d", &n);
  initgraph(&gr_drive, &gr_mode, "");
  rose(n);

  getch();
  closegraph();
}

⌨️ 快捷键说明

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