58 lines
830 B
C++
58 lines
830 B
C++
#include<stdio.h>
|
|
#include<conio.h>
|
|
#include<stdlib.h>
|
|
#include<graphics.h>
|
|
#include<math.h>
|
|
#include<dos.h>
|
|
|
|
|
|
//inicio del main
|
|
int main(void)
|
|
{
|
|
int gdriver=DETECT,gmode,errorcode;
|
|
//inicio de graficos
|
|
initgraph(&gdriver,&gmode,"");
|
|
errorcode=graphresult();
|
|
if(errorcode!=grOk)
|
|
{
|
|
printf("error de graficos: %s\n",grapherrormsg(errorcode));
|
|
printf("presione una tecla");
|
|
getch();
|
|
exit(1);
|
|
}
|
|
//inicio del programa
|
|
int b=10,p=0,i,j,cont=0,a=0,x;
|
|
char c;
|
|
while(cont<500&&(c!='q'))
|
|
{
|
|
clearviewport();
|
|
for(i=0;i<360;i++)
|
|
{
|
|
line(320+p*cos(b*i),200+p*sin(b*i),320+p*cos(b*(i+1)),200+p*sin(b*(i+1)));
|
|
a++;
|
|
if (a==4)
|
|
{
|
|
a=0;
|
|
p=p+4;
|
|
}
|
|
delay(25);
|
|
}
|
|
//nuevos valores para variables
|
|
x=(rand() %15)+1;
|
|
if(x!=5) setcolor(x);
|
|
delay(500);
|
|
b=b+1;
|
|
p=0;
|
|
cont++;
|
|
c=getch();
|
|
}
|
|
//cierra graficos
|
|
getch();
|
|
closegraph();
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|