当前位置:网站首页>Chapter 20: y= sin (x) /x, rambling coordinate system calculation, y= sin (x) /x with profile graphics, Olympic rings, ball rolling and bouncing, water display, rectangular optimization cutting, R que
Chapter 20: y= sin (x) /x, rambling coordinate system calculation, y= sin (x) /x with profile graphics, Olympic rings, ball rolling and bouncing, water display, rectangular optimization cutting, R que
2022-07-03 19:21:00 【Shares_ four】
One 、 Preparation
stay VS2017 in , No, <graphics.h> This library file
Download a piece of software :https://easyx.cn/
//y= sin(x)/x
int main()
{
double t, x;
int k, r, y;
initgraph(640, 480);
setfillcolor(YELLOW);// initialization 640x480 Drawing screen
fillrectangle (50, 20, 570, 320) ; // Set the background
setcolor (BLACK) ;
line (50, 200, 550, 200) ;
line (300, 280, 300, 50) ; // Draw a coordinate axis line
for (r = 1; r <= 5; r = r + 1)
{
line(540, 195, 550 - r, 200);
line(540, 205, 650 - r, 200);
line(295, 60, 300, 50 + r);
line(305, 60, 300, 50 + r);
}
circle(305, 205, 3);
t = 220 / 4 / 3.1415926;
for (k = 80; k <= 520; k = k + 1) // Display graphics by drawing circles
{
x = (k - 300) / t;
y = (int)(200 - 120 * sin(x) / x);
setcolor(GREEN);
setfillcolor(GREEN);
for (r = 1; r <= 2; r++)
fillcircle(k, y, r);
Sleep(30); // Time delay
}
_getch();
closegraph();
return 0;
}
result :
// Ramble coordinate system calculation
int main()
{
long d, j, k, n, s, x, y, z;
printf(" 1 They count -> coordinate ;2 coordinate -> They count ; Please select the calculation item ");
scanf("%d", &z);
if (z==1)
{
printf(" They count -> coordinate , Please enter the number of steps n:");
scanf ("%ld", &n);
s=k=0;
while (1)
{
k++;
s += 2 * k;
d = s - n;
if (abs(d) <= k) break; // Make sure No n The number of layers where the step is located k
}
if (k % 2 > 0 && d < 0)
{
x = k;
y = k + d;
} // Odd layer coordinate assignment
else if (k%2>0 && d>=0)
{
x = k - d;
y = k;
}
else if (k % 2 == 0 && d<0)
{
x = k + d; y = k; // Even layer coordinate assignment
}
else if (k % 2 == 0 && d >= 0)
{
x = k;
y = k - d;
}
printf(" The first %1d Coordinates of the position to which the step goes :%1d,%1d).\n", n, x, y);
}
else
{
printf(" coordinate -> They count , Please enter the coordinates x,y:");
scanf( "%d", &x);
printf("x= %ld", x);
scanf("%d", &y);
//scanf("%1d,%ld", &x,&y);
// printf("x= %ld", x);
printf("y =%ld", y);
k = (x > y ? x : y); // seek x、, The maximum of k Immediate layer :
s = 0;
for (j = 1; j <= k; j++)
s = s + 2 * j;
if (k % 2 > 0) // seek k The number of steps of the layer break point s // The odd layer first goes horizontally to the right , Re vertical
{
if (x == k)
n = s + (k - y);
else
n = s - (k - x);
}
else // Even layers are vertically upward first , Then level
{
if (x == k)
n = s - (k - y);
else
n = s + (k - x);
}
printf(" Stroll to the coordinates (%ld,%ld) It's No %ld Step \n", x, y, n);
}
return 0;
}
result :
P.S. : stay VC2017 in , Use scanf(“%ld”,&x); Always fail , Need to change to scanf(“%d”,&x);
//y= sin(x)/x With profile graphics
int main()
{
double t, x;
int k, r, y,h;
initgraph(640, 480);
setfillcolor(YELLOW);// initialization 640x480 Drawing screen
fillrectangle(50, 20, 570, 320); // Set the background
setcolor(BLACK);
line(50, 200, 550, 200);
line(300, 280, 300, 50); // Draw a coordinate axis line
for (r = 1; r <= 5; r = r + 1)
{
line(540, 195, 550 - r, 200);
line(540, 205, 650 - r, 200);
line(295, 60, 300, 50 + r);
line(305, 60, 300, 50 + r);
}
circle(305, 205, 3);
t = 220 / 4 / 3.1415926;
for (k = 80; k <= 520; k = k + 1) // Display graphics by drawing circles
{
x = (k - 300) / t;
y = (int)(200 - 120 * sin(x) / x);
h = (int)(1 + 12 * fabs(sin(x) / x));
setcolor(CYAN);
setfillcolor(CYAN);
fillellipse(k - 1, y - h, k + 1, y + h);
//for (r = 1; r <= 2; r++)
// fillcircle(k, y, r);
Sleep(30); // Time delay
}
_getch();
closegraph();
return 0;
}
result :
// Olympic rings
int main()
{
int k, i, x, y;
initgraph(640, 180);
setfillcolor(LIGHTGREEN);
bar(50, 40, 430, 240);
setlinestyle(PS_SOLID, 3);
x = 150;
y = 120;
for (i = 0; i <= 4; i++)
{
if (i == 0)
setcolor(BLUE); // Drawing initialization , Clear the screen / Draw a rectangular flag // Adjust the bold pen // loop 5 Time , draw 5 Annulus / Define the brush color of each ring
else if (i == 1)
setcolor(BLACK);
else if (i == 2) setcolor(RED);
else if (i == 3) setcolor(YELLOW);
else setcolor(GREEN);
if (i > 2)
{
x = -75; y = 160;
}
for (k = 0; k <= 8; k++)
circle(x + i * 90, y, 42 - k);
Sleep(1000); // Adjust the center of the next two rings // Draw several concentric circles for each ring to thicken // Proper delay
}
for (k = 0; k <= 8; k++) // Local adjustment makes each ring buckle
{
setcolor(BLUE);
arc(150 - 42 + k, 120 - 42 + k, 150 + 42 - k, 120 + 42 - k, 5.8, 7.0);
setcolor(BLACK);
arc(240 - 42 + k, 120 - 42 + k, 240 + 42 - k, 120 + 42 - k, 3.8, 4.7);
arc(240 - 42 + k, 120 - 42 + k, 240 + 42 - k, 120 + 42 - k, 5.8, 7.0);
setcolor(RED);
arc(330 - 42 + k, 120 - 42 + k, 330 + 42 - k, 120 + 42 - k, 3.8, 6.0);
}
_getch();
closegraph();
return 0;
}
result :
// The ball rolls and bounces
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <graphics.h>
int main()
{
int k, n, x, y;
double h = 300;
double v = 0;
double a = 9.8 / 50;
initgraph(640, 480);
setfillcolor(YELLOW);
fillrectangle(50, 20, 600, 470);
setcolor(BLUE);
setfillcolor(CYAN);
fillrectangle(80, 455, 540, 427); // Set the height // Set the initial speed 1/ Determine the acceleration // Initialize drawing window // Set the background // Draw the ground plane
setfillcolor (BROWN) ;
setlinestyle (PS_SOLID, 3) ;
fillrectangle(100, 120, 372, 100);// Draw desktop
fillrectangle (300, 120, 325, 425) ;
fillrectangle (150, 120, 175, 425) ;
for (x = 120; x <= 372; x = x + 2)
{
setcolor(GREEN);
setfillcolor(GREEN);
fillcircle(x, 72, 25); // Green filled circles with borders
if (x == 120) Sleep(2000);
Sleep(20); // Time delay
setcolor(YELLOW);
setfillcolor(YELLOW);
// Eliminate traces in time
fillcircle(x, 72, 25);
}
for (k = 1; k <= 14; k++)
{
x = 2 * k;
y = (int)sqrt(25 * 25 - x * x);
setcolor(GREEN);
setfillcolor(GREEN);
fillcircle(373 + x, 94 - y, 25);
Sleep(20);
setcolor(YELLOW);
setfillcolor(YELLOW);
fillcircle(373 + x, 94 - y, 25);
}
n = 0;
while (n <= 18)
{
v += a;
h -= (v - a / 2);
if (h <= 0)
{
n++;
h += (v - a / 2);
v = -v * 0.85;
printf("\a");
}
setcolor(GREEN);
setfillcolor(GREEN);
fillcircle(400, 400 - int(h), 25);
Sleep(20);
setcolor(YELLOW);
setfillcolor(YELLOW);
fillcircle(400, 400 - int(h), 25);
}
setcolor(GREEN);
setfillcolor(GREEN);
fillcircle(400, 400, 25);
_getch();
closegraph();
return 0;
}
result :
// Flow display
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <graphics.h>
int main()
{
int d, d1, d2, i, j, k, t, x, y, x1, y1;
initgraph(640, 480);
rectangle(50, 30, 248, 348);
rectangle(18, 30, 250, 350);
setfillcolor(BROWN);
bar(30, 25, 77, 35);
bar(63, 25, 77, 60);
bar(30, 25, 40, 472);
bar(40, 162, 50, 472);
bar(248, 202, 260, 206);
rectangle(255, 202, 258, 194);
bar(253, 194, 260, 190);
bar(248, 344, 260, 348);
rectangle(255, 336, 258, 344);
bar(253, 336, 260, 332);
bar(2, 351, 250, 370);
line(50, 374, 50, 472);
line(50, 472, 620, 472);
line(620, 472, 620, 374);
setfillcolor(GREEN);
fillpie(30, 0, 45, 30, 0, 6.29);
for (k = 1; k<= 2; k++)
{
setfillcolor(GREEN);
bar(51, 378, 618, 471);
t = _getch();
bar(67, 60, 72, 347);
for (y = 347; y >= 60; y--)
{
fillpie(30, 0, 45, 30, 0, -y * 10);
for (x = 51; x <= 247; x++)
putpixel(x, y, GREEN);
for (x = 51; x <= 619; x++)
putpixel(x, 375 + (350 - y) / 3, BLACK);
Sleep(20);
}
t = _getch();
for (y = 60; y <= 347; y++) // Press any key to run water
{
for (x = 51; x <= 247; x++)
putpixel(x, y, BLACK);
if (y <= 203)
for (j = 0; j <= 264; j++)
{
d = (int)sqrt(204 - y);
d1 = (int)(2 * sqrt(j) *d);
d2 = (int)(2 * sqrt(j + 1) *d);
x1 = 260 + d1;
y1 = 204 + j;
d = d2 - d1 + (204 - y) / 70;
setfillcolor(GREEN);
// d、dl. d2 Control figure line
for (i = 0; i <= d; i++) // Water flowing from the upper hole
if ((x1 + i) < 618 && y1 < 490 - y / 3)
solidcircle(x1 + i, y1, 1);
}
for (j = 0; j <= 120; j++)
{
d = (int)sqrt(348 - y);
d1 = (int)(2 * sqrt(j) *d);
d2 = (int)(2 * sqrt(j + 1) *d);
x1 = 260 + d1;
y1 = 346 + j; d = d2 - d1 + (348 - y) / 70;
setfillcolor(GREEN);
for (i = 0; i <= d; i++)
if (y1 < 490 - y / 3 && x1 + i < 618)
solidcircle(x1 + i, y1, 1);
}
if (y % 3 == 0)
for (x = 51; x <= 619; x++)
putpixel(x, 491 - y / 3, GREEN); // The lower tank water level rises
Sleep(50);
setfillcolor(BLACK);
solidrectangle(260, 200, 618, 490 - y / 3);// Remove traces of water
}
}
_getch();
closegraph();
return 0;
}
result :
// Rectangle optimization clipping
#ifndef _CRT_SECURE_NO_WARNINGS // Be sure to use , Otherwise scanf Is the compilation failed
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "list.h"
#include <math.h>
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
void pra(int a, int b);
int pro(int a, int b);
// Rectangle optimized cutting
int ln, w, a, b, d, x, y, x1, y11, x2, y2, x3, y3, x4, y4, max;
long n, min;
int main()
{
void pra (int a, int b);
int pro (int a, int b) ;
int max1, max2, t, i, wmin, lmin, dw, dl;
printf(" Enter the side length of the large rectangle ln, w = ");
scanf("%d,%d", &ln, &w);
printf(" Enter the side length of the small rectangle a, b = ");
scanf("%d,%d", &a, &b);
if (ln < w) {
t = ln; ln = w; w = t; }
if (a < b) {
t = a; a = b; b = t; }
if (ln >= a && w >= b)
{
wmin = w;
lmin = ln;
for (i = 0; i <= w / a; i++)
{
dw = w - i * a - ((w - i * a) / b) * b;
if (dw < wmin) wmin = dw;
}
for (i = 0; i <= ln / a; i++)
{
dl = ln - i * a - ((ln - i * a) / b) * b;
}
if (dl < lmin) lmin = dl;
if (lmin != 0 || wmin != 0)
min = (long)wmin * ln + lmin * w - wmin * lmin;
else
min = (long)ln * w - ((long)ln * w) / (a * b) * a * b;
n = (long)(ln - lmin) * (w - wmin);
n = n / ((long)a * b);
max1 = pro(a, b);
max2 = pro(b, a);
if (max1 >= max2)
{
pro(a, b);
pra(a, b);
}
else
{
pro(b, a);
pra(b, a);
}
}
else
printf(" Cannot cut !\n");
return 0;
}
int pro(int a, int b)
{
int l1, w1, s, i, j, i1, j1, i2, j2, i3, j3, i4, j4;
max = 0;
for (i = ln / a; i >= 0; i--)
{
for (j = w / b; j >= 0; j--)
{
for (i3 = 0; i3 <= ln / a - 1; i3++)
{
for (j3 = 0; j3 <= w / b; j3++)
{
i1 = (ln - i * a) / b;
j1 = (w - j3 * b) / a;
i2 = (ln - 13 * a) / b;
j2 = (w - j * b) / a;
s = i * j + i1 * j1 + i2 * j2 + i3 * j3;
l1 = (i1 + 12) * b - ln;
w1 = (j1 + j2) * a - w;
i4 = 0;
j4 = 0;
if (11 > 0 && w1 > 0 && i1 * j1 > 0 && 12 * j2 > 0)
{
i4 = 11 / b;
j4 = 11 / a;
if (l1 % b != 0) i4++;
if (w1 % a != 0) j4++;
s = s - i4 * j4;
}
if (s > max)
{
max = s;
x = i;
x1 = i1;
x2 = i2;
x3 = i3;
x4 = i4;
y = j;
y11 = j1;
y2 = j2;
y3 = j3;
y4 = j4;
}
}
}
}
}
return max;
}
void pra(int a, int b)
{
int i, j, t, f, g;
initgraph(640, 180);
printf(" Rectangular shearing problem : stay %dx%d On the rectangular plate ", ln, w);
printf(" shear % dx % d The little rectangle of .\n", a, b);
printf(" The upper bound of the number of small cut rectangles is :%1d individual ", n);
printf(" You can cut %d A small pitch :\n", max);
if (ln > 560 || w > 400)
{
t = ln / 560;
f = w / 400;
g = f + 1;
if (t > f)
g = t + 1;
ln = ln / g;
w = w / g;
a = a / g;
b = b / g;
}
setfillcolor(YELLOW);
bar(60, 60, 60 + ln, 60 + w);
setfillcolor(BROWN);
printf(" You can cut % d A little rectangle :/n", max);
if (ln > 560 || w > 400) // , When the size is too large, the graphics are scaled down
{
t = ln / 560;
f = w / 400;
g = f + 1;
if (t > f)
g = t + 1;
ln = ln / g;
w = w / g;
a = a / g;
b = b / g;
}
setfillcolor(YELLOW);
bar(60, 60, 60 + ln, 60 + w); // Yellow filling material large rectangle // Brown fill cut small rectangle
setfillcolor(BROWN);
for (i = 1; i <= x; i++)
for (j = 1; j <= y; j ++)
bar(61 + (i - 1) * a, 61 + (j - 1) * b, 59 - i * a, 59 + j * b);
for (i = 1; i <= x3; i++)
for (j = 1; j <= y3; j++)
bar(59 + ln - (i - 1) * b, 59 + w - (j - 1) * b, 61 + ln - i * a, 61 + w - j * b);
for (i = 1; i <= x1; i++)
for (j = 1; j <= y11; j ++)
bar(59 + ln - (i - 1) * b, 61 + (j - 1) * a, 61 + ln - i * b, 59 + j * 0);
for (i = 1; 1 <= x2; i++)
for (j = 1; j <= y2; j++)
if (!(x4 * y4 > 0) && i > x2 - x4 && j > y2 - y4)
bar(61 + (i - 1) * 6, 59 + w - (j - 1) * a, 59 + i * b, 61 + w - j * a);
_getch();
closegraph();
}
//
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <graphics.h>
void pra(int n);
int p(int k);
int g();
//r All queens control nxn The board
int r, m, n, a[30];
long s = 0;
int main()
{
int p(int k);
printf(" R All queens nxn The board , Please enter r,n");
scanf("%d,%d",&r,&n);
printf(" The first m Solution output graph , Please make sure m");
scanf("%d", &m); // Call from 1 The number begins
p(1);
printf("\n %d Full control after three stars %d x %d The board , More than %ld A solution .\n", r, n, n, s);
return 0;
}
// Queen fully controlled recursive function
int p(int k)
{
int h, i, j, u;
int g();
pra(n);
if (k <= n)
{
for (i = 0; i < -n; i++)
{
a[k] = i;
for (u = 0, j = 1; j <= k - 1; j++)
if (a[j] != 0 && a[k] == a[j] || a[k] * a[j] > 0 && abs(a[k] - a[j]) == k - j)
u = 1;// If there is the same or the same oblique period of non-zero elements
if (u == 0) // Ruodi k Number can be set i, Check whether n Number Lif(fe = n)
{
if(k ==n)
{
for (h = 0, j = 1; j <= n; j++)
if (a[i] == 0) h++;
if (h == n - r)
{
if (g() == 0)
{
s++;
printf("");
for (j = 1; j <= n; j++)
printf("%d", a[j]);
if (s % 5 == 0)
printf("\n");
if (s == m) pra(n); // Output graphic solution
}
}
}
else p(k + 1);
}
}
}
return s; // Check whether the chessboard fully controls the function
}
int g()
{
int c, f, j, t, b[20][20];
t = 0;
for (c = 1; c <= n; c++)
for (j = 1; j <= n; j++)
b[c][j] = 0;
for (f = 1; f <= n; f++)
{
if (a[f] != 0)
{
for (j = 1; j <= n; j++)
{
b[f][j] = 1;
b[j][a[f]] = 1;
if (f + abs(a[f] - j) <= n)
b[f + abs(a[f] - j)][j] = 1;
if (f - abs(a[f] - j) >= 1)
b[f - abs(a[f] - j)][j] = 1;
}
}
}
for (c = 1; c <= n; c++)
for (j = 1; j <= n; j++)
if (b[c][j] == 0)
{
t = 1;
c = n;
break;
}
return t;// There is a space in the chessboard that cannot be controlled .
}
//r All queens control nxn Chessboard graphics function
void pra (int n)
{
int c,d;
initgraph (640, 480) ;
setcolor (BROWN) ; // Draw a checkerboard border
setlinestyle (PS_SOLID, 1) ;
rectangle(160, 20, 161 + n * 46, 20 + n * 40);
rectangle(158, 18, 163 + n * 16, 22 + n * 40);
for (c=1;c<=n;c++)
for (d = 1; d <= n; d++)
{
setcolor(BLACK); // Draw checkerboard squares
if ((c + d) % 2 == 0)
setfillcolor(WHITE);
else
setfillcolor(CYAN); // Checkerboards are filled with each other
bar(160 + (d - 1) * 46, 20 + (c - 1) * 40, 160 + d * 46, 20 * c * 40);
Sleep(200); // Proper delay
if (a[c] == d) // Face the Queen's crown of the line
{
rectangle(123 + d * 46, c * 40, 151 + d * 46, 5 + c * 40);
Sleep(100);
rectangle(123 + d * 46, 5 + c * 10, 151 + d * 16, 10 + c * 10);
Sleep(100);
line(123 + d * 46, c * 40, 118 + d * 16, c * 40 - 10);
line(129 + d * 46, c * 40, 118 + d * 46, c * 40 - 10);
Sleep(100);
line(129 + d * 46, c * 40, 133 + d * 46, c * 40 - 10);
line(137 + d * 16, c * 40, 133 + d * 46, c * 40 - 10);
Sleep(100);
line(137 + d * 16, c * 40, 141 + d * 46, c * 40 - 10);
line(145 + d * 46, c * 40, 141 + d * 16, c * 40 - 10);
Sleep(100);
line(145 + d * 16, c * 40, 156 + d * 16, c * 10 - 10);
line(151 + d * 46, c * 40, 156 + d * 46, c * 40 - 10);
Sleep(100);
}
}
_getch();
closegraph();
}
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <graphics.h>
#include "function.h"
void pra(int n, int m);
//int p(int k);
int g();
//r All queens control nxm The board
int m, n, a[20];
//long s = 0;
int main()
{
int i, h, k, d, j, p, r, s, x;
printf(" R All queens nxm The board , Please enter n,m");
scanf("%d,%d", &n, &m);
printf("%d %d", n, m);
printf("R A queen controls , Please enter R R <= N,M");
scanf("%d", &r);
printf(" The first p Solution output graph , Please make sure the P");
scanf("%d", &p);
i = 1;
s = 0;
a[1] = 0;
while (1)
{
d = 1;
for (k = i - 1; k >= 1; k--)
{
x = a[i] - a[k];
if (a[k] != 0 && x == 0 || a[i] * a[k] > 0 && abs(x) == i - k)
d = 0;
// printf("1\r\n");
}
if (i == n && d == 1)
{
h = 0;
for (j = 1; j <= n; j++)
if (a[j] == 0)
h++;
if (h == n - r)
{
if (g() == 0)
{
s++;
for (j = 1; j <= n; j++)
printf("%d", a[j]);
printf(" ");
if (s % 5 == 0)
printf("\n");
if (s == p) pra(n, m); // Output graphic solution
}
}
}
if (i < n && d == 1)
{
//printf("2\r\n");
i++;
a[i] = 0;
continue;
}
while (a[i] == m && i > 1)
{
i--;
//printf("%d\r\n", i);
}
if (a[i] == m && i == 1)
{
printf(" Jump out of while");
break;
}
else
a[i] = a[i] + 1;
}
if (s > 0)
printf("%d A queen controls %d x %d The board , There are more than %d A solution ", r, n, m, s);
else
printf(" The problem has no solution ");
if (p > s)
printf(" Unable to output graphic solution ");
}
int g()
{
//printf(" call G");
int c, f, j, t, b[20][20];
t = 0;
for (c = 1; c <= n; c++)
for (j = 1; j <= m; j++)
b[c][j] = 0;
for (f = 1; f <= n; f++)
if (a[f] != 0)
{
for (c = 1; c <= n; c++)
b[c][a[f]] = 1;
//b[j][a[f]] = 1;
for (j = 1; j <= m; j++)
{
b[f][j] = 1;
if (f + abs(a[f] - j) <= n)
b[f + abs(a[f] - j)][j] = 1;
if (f - abs(a[f] - j) >= 1)
b[f - abs(a[f] - j)][j] = 1;
}
}
for (c = 1; c <= n; c++)
for (j = 1; j <= m; j++)
if (b[c][j] == 0)
//{
t = 1;
// c = n;
//break;
//}
return t;// There is a space in the chessboard that cannot be controlled .
}
//r All queens control nxn Chessboard graphics function
void pra(int n, int m)
{
//printf(" Call the graph ");
int c, j;
initgraph(640, 480);
setcolor(BROWN); // Draw a checkerboard border
setlinestyle(PS_SOLID, 2);
rectangle(156, 16, 164 + m * 46, 24 + n * 40);
rectangle(158, 18, 162 + m * 46, 22 + n * 40);
for (c = 1; c <= n; c++)
for (j = 1; j <= m; j++)
{
setcolor(BLACK); // Draw checkerboard squares
if ((c + j) % 2 == 0)
setfillcolor(WHITE);
else
setfillcolor(CYAN); // Checkerboards are filled with each other
bar(160 + (j - 1) * 46, 20 + (c - 1) * 40, 160 + j * 46, 20 * c * 40);
Sleep(200); // Proper delay
if (a[c] == j) // Face the Queen's crown of the line
{
setfillcolor(BLUE);
bar(123 + j * 46, c * 40, 151 + j * 46, 5 + c * 40);
// Sleep(100);
setfillcolor(RED);
bar(123 + j * 46, 5 + c * 40, 151 + j * 46, 10 + c * 40);
// Sleep(100);
line(123 + j * 46, c * 40, 118 + j * 46, c * 40 - 10);
line(129 + j * 46, c * 40, 118 + j * 46, c * 40 - 10);
// Sleep(100);
fillcircle(118 + j * 46, c * 40 - 10, 2);
line(129 + j * 46, c * 40, 133 + j * 46, c * 40 - 10);
line(137 + j * 16, c * 40, 133 + j * 46, c * 40 - 10);
fillcircle(133 + j * 46, c * 40 - 10, 2);
// Sleep(100);
line(137 + j * 16, c * 40, 141 + j * 46, c * 40 - 10);
line(145 + j * 46, c * 40, 141 + j * 16, c * 40 - 10);
fillcircle(141 + j * 46, c * 40 - 10, 2);
// Sleep(100);
line(145 + j * 16, c * 40, 156 + j * 16, c * 10 - 10);
line(151 + j * 46, c * 40, 156 + j * 46, c * 40 - 10);
fillcircle(156 + j * 46, c * 40 - 10, 2);
// Sleep(100);
}
}
_getch();
closegraph();
}
``
result :


边栏推荐
- 第一章:求同吗小数和s(d, n)
- Record: writing MySQL commands
- 【光学】基于matlab涡旋光产生【含Matlab源码 1927期】
- The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
- High concurrency Architecture - separate databases and tables
- Yolov3 network model building
- 交叉编译Opencv带Contrib
- Differential constrained SPFA
- Record: install MySQL on ubuntu18.04
- Zhang Fei hardware 90 day learning notes - personal record of day 3, please see my personal profile / homepage for the complete
猜你喜欢
04 -- QT OpenGL two sets of shaders draw two triangles
[optics] vortex generation based on MATLAB [including Matlab source code 1927]
FBI warning: some people use AI to disguise themselves as others for remote interview
The earliest record
[optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]
第一章:简化同码小数和s(d, n)
【LeetCode】【SQL】刷题笔记
QT -- qfileinfo file information reading
BUUCTF
【学术相关】顶级论文创新点怎么找?中国高校首次获CVPR最佳学生论文奖有感...
随机推荐
Nous avons fait une plateforme intelligente de règlement de détail
Smart wax therapy machine based on STM32 and smart cloud
第一章:求所有阶乘和数,大奖赛现场统分程序设计,三位阶乘和数,图形点扫描,递归求n的阶乘n!,求n的阶乘n!,舍罕王失算
DriveSeg:动态驾驶场景分割数据集
Dynamic planning -- expansion topics
【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】
EGO Planner代码解析bspline_optimizer部分(1)
Bad mentality leads to different results
Yolov3 network model building
第一章:求n的阶乘n!
Summary of 90 day learning materials and notes of Zhang Fei's actual electronic hardware engineer
Web Security (VIII) what is CSRF attack? Why can token prevent csdf attacks?
第一章:求同吗小数和s(d, n)
Luogu-p1107 [bjwc2008] Lei Tao's kitten
Why should the gradient be manually cleared before back propagation in pytorch?
[free sharing] kotalog diary2022 plan electronic manual ledger
第二章:基于分解的求水仙花数,基于组合的求水仙花数, 兰德尔数,求[x,y]内的守形数,探求n位守形数,递推探索n位逐位整除数
第一章: 舍罕王失算
Comments on flowable source code (37) asynchronous job processor
High concurrency Architecture - separate databases and tables