000.c
上传用户:jsyccqq
上传日期:2022-08-09
资源大小:2k
文件大小:1k
- #include<stdio.h>
- #include<graphics .h>
- #include<math.h>
- #define PI 3.1415926
- main()
- {
- int gdriver=DETECT,gmode,i,x,y;;
- initgraph(&gdriver,&gmode,"自己的盘在哪里就弄到哪里\win-tc");
- setbkcolor(BLUE);
- /*烟花屏幕函数*/
- for(i=1;i<=639;i++)
- {x=rand()%400;
- y=rand()%200;
- putpixel (x,y,WHITE);
- }
- rise();
- getch();
- }
- /*烟花上升函数*/
- rise()
- {
- int n,x,y,j,x1,y1,u;
- float q;
- /*烟花上升轨迹*/
- for(n=1;n<=10;n++)
- {
- x=rand()%400+100;
- y=rand()%100+300;
- x1=x;
- y1=y-20;
- setlinestyle(1,0,3);
- for(j=1;j<=20;j++)
- {setcolor(rand()%15);
- line(x,y,x1,y1);
- delay(5000);
- setcolor(BLUE);
- line(x,y,x1,y1);
- y1=y1-j;
- y=y-j;}
- /*声音函数*/
- for(u=6000;u>=3000;u=u-100)
- { sound(u);
- delay(800);
- } nosound();
- /*烟花爆炸函数*/
- for(q=0;q<=2*PI;q+=0.15)
- { x1=x+80*cos(q);
- y1=y+80*sin(q);
- setcolor(rand()%15);
- line(x,y,x1,y1);
- delay(1000);}
- for(q=0;q<=2*PI;q+=0.15)
- {x1=x+80*cos(q);
- y1=y+80*sin(q);
- setcolor(BLUE);
- line(x,y,x1,y1);}
- }
- getch();
- }