实现一QQ表情
大笑表情 在TC编译环境下#include <graphics.h>
void DrawLaugh(int x,int y,int r)
{
int c1=YELLOW,c2=RED,c3=WHITE;
int d = r/5;
setcolor(c1);
circle(x,y,r);
setfillstyle(1,0);
floodfill(x,y,c1);
setcolor(c2);
line (x-d,y-d*3,x-d*2,y-4*d);
line (x-2*d,y-4*d,x-2.9*d,y-4*d);
line (x+d,y-d*3,x+2*d,y-4*d);
line (x+2*d,y-4*d,x+2.9*d,y-4*d);
line(x-3.5*d,y-2*d,x-2.5*d,y-2.6*d);
line(x-2.5*d,y-2.6*d,x-1.5*d,y-2*d);
line(x+3.5*d,y-2*d,x+2.5*d,y-2.6*d);
line(x+2.5*d,y-2.6*d,x+1.5*d,y-2*d);
pieslice(x,y,180,360,4*d);
setfillstyle(1,c3);
floodfill(x,y+d,c2);
line(x-2*d,y,x-2*d,y+3.5*d);
line(x+2*d,y,x+2*d,y+3.5*d);
line(x,y,x,y+4*d);
line(x+3.5*d,y,x+3.5*d,y+1.8*d);
}
void Laugh(int x,int y)
{
int d,i,r,flag=0;
d=6;i=0;
r=10;
while(!kbhit())
{
DrawLaugh(x,y+i,r);
delay(10000);
setfillstyle(1,BLACK);
pieslice(x,y+i,0,360,r);
if(i==d)
flag=1;
if(i==0)
flag =0;
if(flag ==0)
i++;
else
i--;
}
}
main ()
{
int gm,gd;
int x,y;
x= 100;
y=100;
gd = DETECT;
registerbgidriver(EGAVGA_driver);
initgraph(&gd,&gm,"");
Laugh(x,y);
getch();
cleardevice();
}