circle
demonstrate how to make a circle with out using the provided circle command. for those of you who have ever need to make use of the symetry of a circle here's a program that will help. The code provided is made into a simple screen saver
AI
एआई सारांश: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
सोर्स कोड
//by: psypher whopper
#include <stdio.h>
#include <time.h>
#include <conio.h>
#include <graphics.h>
#include <math.h>
#include <dos.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int gdriver = DETECT, gmode;
double x, y, theta, r;
int i, c, thetamax, step;
initgraph(&gdriver, &gmode, "");
struct palettetype pal;
getpalette(&pal);
for (i=0; i<pal.size; i++)
setrgbpalette(pal.colors[i], i * 2 , 2, i*4);
randomize();
do {
for (i=0; i<pal.size; i++)
setrgbpalette(pal.colors[i], i * random(14) ,i * random(14), i * random(14));
r = random(230) + 20;
thetamax = random(360) + 1;
step = random(15) + 1;
for(theta = 0; theta <= thetamax; theta+=step)
{
if(kbhit())
c = getch();
x = cos(theta);
y = sin(theta);
setcolor(random(14)+ 1);
delay(10);
rectangle(300 + x * r, 200 + y * r, 350 + x * r, 250 + y * r);
}
for(theta = 0; theta <= thetamax; theta+=step)
{
if(kbhit())
c = getch();
x = cos(theta);
y = sin(theta);
setcolor(0);
delay(10);
rectangle(300 + x * r, 200 + y * r, 350 + x * r, 250 + y * r);
}
if(kbhit())
c = getch();
} while(c != 13);
return(0);
}
Upload
मूल टिप्पणियाँ (3)
Wayback Machine से पुनर्प्राप्त