签到

05月08日
尚未签到

共有回帖数 0

    雷神

    等级:
    C语言特效集锦小第在此抛砖引玉
    希望各位踊跃跟贴
    把自己的收藏贡献出来
      本人声明 以下代码从各处网站收集而来  非原传
    /*------非常漂亮的4-瓣花型图案---*/
    #includemath.h
    #includegraphics.h
    #define PI 3.14159
    #define D 100
    main()
    { float a,e,x1,y1,x2,y2;
    int gdriver=VGA,gmode=VGAHI;
    initgraph(&gdriver,&gmode,"c:\tc");
    cleardevice();
    setcolor(GREEN); setbkcolor(0);
    for(a=0.0;a2*PI;a+=2*PI/720)
    {
    e=D*(1+sin(4*a));
    x1=320+e*cos(a);
    x2=320+e*cos(a+PI/5);
    y1=240+e*sin(a);
    y2=240+e*sin(a+PI/5);
    line(x1,y1,x2,y2);
    }
    getch();
    closegraph(); }
    /*---流星飞逝,用鼠标控制方向----*/
    #include DOS.H  
    #includegraphics.h  
    #includestdlib.h  
    #includemath.h  
    #define maxcircle 20  
    main()  
    {union REGS r;  
    int dr=DETECT,mode=0;  
    int mx,my,mc;  
    int i,ds, color[maxcircle];  
    double fx,fy,force=0;  
    double s,x[maxcircle],y[maxcircle],rr[maxcircle];  
    initgraph(&dr,&mode,"c:\tc");  
    r.x.ax=0;  
    int86(0X33,&r,&r);  
    r.x.ax=2;  
    int86(0x33,&r,&r);  
    for(i=0;imaxcircle;i++)  
    {color=random(16)+1;  
    x=random(640);  
    y=random(480);  
    rr=random(5)+1; }  
    while(!kbhit())  
    { r.x.ax=3;  
    int86(0x33,&r,&r);  
    mx=r.x.cx;  
    my=r.x.dx;  
    mc=r.x.bx;  
    for(i=0;imaxcircle;i++)  
    { fx=mx-320;  
    fy=my-240;  
    s=sqrt(fx*fx+fy*fy);  
    if(s!=0)  
    { setcolor(0);  
    setfillstyle(1,0);  
    fillellipse(x,y,rr,rr);  
    setcolor(color);  
    setfillstyle(1,color);  
    force=random(50)/(double)10;  
    x+=fx/s*force;  
    y+=fy/s*force;  
    if(x640)x=0;  
    if(x0)x=640;  
    if(y480)y=0;  
    if(y0)y=480;  
    fillellipse(x,y,rr,rr); } }  
    if(mc==1)  
    {  
    cleardevice();  
    for(i=0;imaxcircle;i++)  
    {x=random(640);  
    y=random(480);  
    rr=random(5)+1;  
    color=random(16)+1;  
    fillellipse(x,y,rr,rr);  
    } } }
    } 

    /*----- 旋转的立体椭球 -----*/
    #include graphics.h
    #include math.h
    #include conio.h
    #define PI 3.14159
    #define T PI/180
    #define NN 36
    #define DT PI/NN
    #define DIST 0.8
    #define R 190
    static int n=1;
    void ans(t,s)
    float t[3];
    float s[3][3];
    {
    s[0][0]=cos(t[1])*cos(t[2]); s[0][1]=cos(t[1])*sin(t[2]);
    s[0][2]=-sin(t[1]);
    s[1][0]=sin(t[0])*sin(t[1])*cos(t[2])-cos(t[0])*sin(t[2]);
    s[1][1]=sin(t[0])*sin(t[1])*sin(t[2])+cos(t[0])*cos(t[2]);
    s[1][2]=sin(t[0])*cos(t[1]);
    s[2][0]=cos(t[0])*sin(t[1])*cos(t[2])+sin(t[0])*sin(t[2]);
    s[2][1]=cos(t[0])*sin(t[0])*sin(t[2])-sin(t[0])*cos(t[2]);
    s[2][2]=cos(t[0])*cos(t[1]);
    }
    void draw(m,da,db)
    float m[3][3],da,db;
    {
    float f[3],f0 , x0,y0,x1,y1,x2,y2;
    f[0]=R*sin(da)*cos(db); f[1]=R*sin(da)*sin(db);
    f[2]=R*cos(da);
    f0=f[0]*m[0][2]+f[1]*m[1][2]+f[2]*m[2][2];
    if(f0=0) n=1;
    else
    {
    x0=300.0;y0=165.0;
    x2=(m[0][0]*f[0]+m[1][0]*f[1]+m[2][0]*f[2])+x0;
    y2=(m[0][1]*f[0]+m[1][1]*f[1]+m[2][1]*f[2])*DIST+y0;
    if(n==1) {n=2;x1=x2;y1=y2;}
    else
    {
    line(x1,y1,x2,y2);
    x1=x2;y1=y2;
    }}}
    main()
    {
    float d[3],r[3][3],ta,tb;
    char k;
    int gdriver=VGA,gmode=VGAMED, i,p=1;
    initgraph(&gdriver,&gmode,"c:\tc");
    setbkcolor(BLACK);setcolor(GREEN);
    d[1]=30*T; d[2]=10*T;
    do{
    for(i=0;i=361;i+=1)
    {
    k=kbhit();
    if(k!=0)break;
    setactivepage(p);
    d[0]=i*T;
    cleardevice();
    ans(d,r);
    for(tb=0.0;tbPI;tb+=DT)
    {
    n=1;
    for(ta=0.0;ta2.1*PI;ta+=DT) draw(r,ta,tb);}
    for(ta=0.0;taPI;ta+=DT)
    {
    n=1;
    for(tb=0.0;tb2.1*PI;tb+=DT) draw(r,ta,tb);
    }
    setvisualpage(p);delay(1500);p=1-p;
    }
    }
    while(k==0);
    getch();closegraph();
    }

    /*......不知道什么 自己看吧....*/
    #include DOS.H
    #includegraphics.h
    #includestdlib.h
    #includemath.h
    #define NUM 60
    struct star
    {
    int x;/* x坐标*/
    int y;/*y坐标*/
    int dx;/* x增量*/
    int dy;/* y增量*/
    int r;/*半径*/
    int c;/*颜色*/
    int t;
    }c[NUM];
    void init() /*图形驱动*/
    {
    int dr=DETECT,mode=0;
    initgraph(&dr,&mode,"c:\tc");
    /*界*/
    setfillstyle(SOLID_FILL,WHITE);
    bar(8,8,632,472);
    setfillstyle(SOLID_FILL,BLACK);
    bar(10,10,630,470);
    }
    void d_circle(int x, int y,int r,int c,int flag)
    {
    setcolor(c*flag);
    setfillstyle(1,c*flag);
    fillellipse(x,y,r,r);
    }
    void randstar()
    {int i;
    for(i=0;iNUM;i++)
    {
    c.dx=rand()%20-10;
    c.dy=rand()%20-10;
    c.c=rand()%254;
    c.x=320+c.dx;
    c.y=240+c.dy;
    c.t==0;
    c.r=1;
    }
    }
    void Delay(int time)/*延迟函数*/
    {long i,j;
    for (i=0;i100*time;i++)
    for(j=0;j10000;j++) ;
    }
    void hit(int i)/*判断是否过界*/
    {
    if (c.x20||c.x620||c.y40||c.y440)
    {c.x=320;
    c.y=240;
    c.r=1;
    c.t=0;
    }
    }
    void shine()
    {int i;
    while(!kbhit())/*按任意键推出濉*/
    {for(i=0;iNUM;i++)
    {
    d_circle(c.x, c.y,c.r,c.c,0);/*覆盖原来的圆*/
    c.t++;
    if(!(c.t%20)) c.r++;
    c.x=c.x+c.dx;
    c.y=c.y+c.dy;
    hit(i);
    d_circle(c.x, c.y,c.r,c.c,1);/*画新的圆*/
    delay(1);
    }
    Delay(20);
    }
    }
    void main()
    {
    init();
    randstar();
    shine();
    getch();
    }
    


    /*简单的烟花程序*/
    #include stdlib.h
    #include stdio.h
    #include"graphics.h"
    main()
    {int gd=DETECT,gr,a[8],b[8],x,y,i,j,c;
    initgraph(&gd,&gr,"c:\tc");
    randomize();
    for(;!kbhit();)
    {x=rand()%500+100; /*随机中心坐标*/
    y=rand()%300+100;
    a[0]=x; /*各点坐标的计算,我的烟花图形没能是圆的*/
    b[0]=y-10;
    a[1]=a[0]+5;
    a[2]=a[1]+5;
    a[3]=a[1];
    a[4]=a[0];
    a[5]=a[0]-5;
    a[6]=a[5]-5;
    a[7]=a[6]+5;
    for(j=1;j5;j++ )
    b[j]=b[j-1]+5;
    for(j=5;j8;j++ )
    b[j]=b[j-1]-5;
    for(j=0;j6;j++ ) /*烟花的大小设定*/
    {
    for(i=0;i8;i++ )
    {
    c=rand()%9+ 1; /*各点的颜色随机*/
    setcolor©;
    circle(a,b,1);
    }
    delay(10000);
    cleardevice();
    b[0]-=10; /*各点的坐标变换*/
    a[1]+=5;
    b[1]-=5;
    a[2]+=10;
    a[3]+=5;
    b[3]+=5;
    b[4]+=10;
    a[5]-=5;
    b[5]+=5;
    a[6]-=10;
    a[7]-=5;
    b[7]-=5;
    }
    }
    getch();
    closegraph();


    /*简单的下雪程序*/
    #include stdlib.h
    #include stdio.h
    #includegraphics.h
    struct Snow/*雪的一些参数*/
    {
    int x;
    int y;
    int speed;
    }snow[100];
    int snownum=0;/*雪的个数*/
    int size;/*保存区域的大小*/
    int change=10;/*变颜色有关*/
    void *save1,*save2;/*保存空间*/
    void Copy();/*保存区域*/
    void DrawSnow();/*具体实现*/
    void Pr();/*输出字体以及发声音*/
    void main(void)
    {int gd=DETECT,gm;
    initgraph(&gd,&gm,"c:\tc");
    Copy();
    DrawSnow();
    getch();
    closegraph();
    }
    void Copy()
    {
    setcolor(0);
    setfillstyle(SOLID_FILL,15);
    fillellipse(200,200,4,4);
    size=imagesize(196,196,204,204);
    save1=malloc(size);
    save2=malloc(size);
    getimage(196,196,204,204,save1);
    getimage(96,96,104,104,save2);
    }
    void Pr()
    {
    int s[15]={0,100,150,200,150,200,250,150,250,300,250,150,100,250,350};/*这里可以自己编调子*/
    setcolor(change/10);
    settextstyle(0,0,4);
    outtextxy(100,200,"Merry Christmas");
    sound(s[change/10]);
    }
    void DrawSnow()
    {int i;
    int sx[62];
    randomize();
    for(i=0;i62;i++)
    sx=(i+2)*10;
    cleardevice();
    while(!kbhit())
    {
    Pr();
    if(snownum!=100)
    {
    snow[snownum].speed=2+random(5);
    i=random(62);
    snow[snownum].x=sx;
    snow[snownum].y=10-random(100);
    }
    for(i=0;isnownum;i++)/*去雪*/
    putimage(snow.x,snow.y,save2,COPY_PUT);
    Pr();
    if(snownum!=100)
    snownum++ ;
    /*delay(300);*/
    setfillstyle(SOLID_FILL,15);/*画雪*/
    for(i=0;isnownum;i++)
    {
    snow.y+=snow.speed;
    putimage(snow.x,snow.y,save1,COPY_PUT);
    if(snow.y500)
    snow.y=10-random(200);
    }
    change ;
    if(change==140)/*和颜色的变化有关*/
    change=10;
    }
    nosound();
    }
    

    #includegraphics.h
    #includemath.h
    /*一箭穿心*/
    #define FNX(x1) (int)(x+(x1)*sl)
    #define FNY(y1) (int)(MAXY-(y+(y1)*sl))
    #define R(theta) 1-pow(cos(1*theta),1)

    int sl=50,MAXY;
    float x1,y1,xs,ys,r,theta;
    /*画心*/
    void draw(int x,int y)
    {
    for(theta=0;theta2*3.14;theta+=0.01)
    {r=R(theta);
    x1=r*sin(theta);y1=r*cos(theta);
    xs=FNX(x1);ys=FNY(y1);
    if(theta==0)moveto(xs,ys);else lineto(xs,ys);
    }
    }

    /*画箭头*/
    void jian()
    {
    line(205,235,200,240);
    line(200,240,205,245);
    line(200,240,214,240);
    line(400,240,500,240);
    line(485,235,480,240);
    line(480,240,485,245);
    line(490,235,485,240);
    line(485,240,490,245);
    line(495,235,490,240);
    line(490,240,495,245);
    line(500,235,495,240);
    line(495,240,500,245);
    line(505,235,500,240);
    line(500,240,505,245);
    line(485,235,505,235);
    line(485,245,505,245);
    }
    /*主程序*/
    main()
    {int driver=DETECT,mode;
    initgraph(&driver,&mode,"c:\tc");
    setbkcolor(1);
    setcolor(4);
    MAXY=getmaxy();
    draw(280,280);/*左心*/
    draw(370,280);/*右心*/
    jian();
    getch();
    closegraph();
    }

    #include dos.h
    #include graphics.h
    #include math.h
    /*玫瑰花*/
    #define FNX(x) (int)(xo+(x)*1.0)
    #define FNY(y) (int)(getmaxy()-(yo+(y)*1.0))
    #define FNX2(phi) cos(phi)*ac-sin(phi)*bs
    #define FNY2(phi) cos(phi)*as+sin(phi)*bc

    /*画旋转的椭圆*/
    void elli(int xo,int yo,int a,int b,double theta)
    {
    int i;
    double da,c,s,ac,as,bc,bs,xf,yf,phi,x,y;
    theta=theta*0.01745;
    da=3*0.1745;
    c=cos(theta);s=sin(theta);
    ac=a*c;as=a*s;bc=b*c;bs=b*s;
    x=FNX2(0);y=FNY2(0);
    moveto(FNX(x),FNY(y));
    for(i=1;i=360;i++)
    {
    phi=i*da;xf=x*cos(phi)*0.1;yf=b*sin(phi)*0.1;
    x=FNX2(phi);y=FNY2(phi);
    lineto(FNX(x),FNY(y));
    }
    }

    /*花*/
    void hua(int x,int y)
    {
    register i;
    /*画粉红色玫瑰*/
    setcolor(12);
    arc(x+65,y-60,150,350,8);
    arc(x+66,y-54,300,470,8);
    arc(x+65,y-56,30,230,10);
    arc(x+64,y-57,300,490,17);
    ellipse(x+73,y-30,250,450,27,40);
    ellipse(x+59,y-30,100,290,27,40);
    ellipse(x+65,y-40,140,270,20,30);
    setfillstyle(SOLID_FILL,5);
    floodfill(x+65,y-20,12);
    /*画红色玫瑰*/
    arc(x,y,150,350,12);
    arc(x+1,y+8,280,470,12);
    arc(x,y+2,30,230,16);
    arc(x,y+3,80,240,28);
    arc(x+2,y+8,180,330,22);
    arc(x-2,y+2,310,460,25);
    ellipse(x-12,y+30,120,300,30,40);
    ellipse(x+10,y+28,250,423,30,42);
    ellipse(x-4,y+10,290,393,30,40);
    setfillstyle(SOLID_FILL,4);
    floodfill(x+5,y+31,12);
    /*画紫色花骨朵*/
    ellipse(x+120,y+5,0,360,15,25);
    setfillstyle(SOLID_FILL,1);
    floodfill(x+120,y,12);
    /*画黄色花骨朵*/
    ellipse(x-70,y+10,0,360,14,20);
    setfillstyle(SOLID_FILL,14);
    floodfill(x-70,y+10,12);
    setcolor(10);
    /*画红花花萼*/
    ellipse(x-15,y+32,190,310,30,35);
    ellipse(x+16,y+32,235,355,26,35);
    ellipse(x,y+35,190,350,43,50);
    arc(x,y+82,190,350,6);
    setfillstyle(SOLID_FILL,2);
    floodfill(x,y+75,10);
    /*画粉花花萼*/
    ellipse(x+50,y-48,190,320,22,50);
    ellipse(x+80,y-48,220,350,22,50);
    ellipse(x+65,y-28,180,360,36,50);
    floodfill(x+65,y+18,10);
    /*画主枝*/
    for(i=0;i3;i++ )
    {
    ellipse(x-98,y+100+i,255,371,100,80);
    ellipse(x-20,y+30+i,260,358,140,140);
    ellipse(x+224,y+20+i,180,218,160,140);
    }
    /*画侧枝*/
    ellipse(x+70,y+34,180,233,140,140);
    ellipse(x,y+40,205,255,100,120);
    ellipse(x+135,y-30,209,249,72,120);
    ellipse(x,y+20,263,301,100,120);
    ellipse(x+85,y-10,278,305,100,120);
    ellipse(x+100,y-62,282,308,90,120);
    ellipse(x-50,y-10,277,314,30,120);
    ellipse(x+70,y+80,222,266,52,120);
    ellipse(x-60,y-45,229,266,52,120);
    ellipse(x+79,y-45,229,266,52,120);
    ellipse(x+84,y,224,273,52,120);
    ellipse(x+110,y+40,240,282,100,120);
    /*画紫花骨朵花萼*/
    ellipse(x+120,y-6,200,340,17,25);
    ellipse(x+120,y+7,160,380,17,27);
    floodfill(x+122,y+30,10);
    /*画黄花骨朵花萼*/
    ellipse(x-70,y+15,140,390,17,20);
    ellipse(x-75,y-10,205,340,10,30);
    ellipse(x-60,y-10,195,340,5,30);
    floodfill(x-70,y+32,10);
    /*画叶*/
    /*画右边的叶子*/
    elli(x+168,y+282,10,20,-40);
    elli(x+160,y+252,8,16,260);
    elli(x+145,y+270,8,16,-15);
    elli(x+156,y+224,10,20,-45);
    elli(x+150,y+200,8,16,270);
    elli(x+135,y+220,8,16,-10);
    elli(x+146,y+144,8,16,-80);
    elli(x+130,y+130,6,12,235);
    elli(x+125,y+154,7,14,-10);
    elli(x+78,y+98,6,12,-90);
    elli(x+60,y+90,5,10,180);
    elli(x+70,y+109,5,10,-45);
    /*画左边的叶子*/
    elli(x-125,y+270,12,24,60);
    elli(x-95,y+270,10,20,10);
    elli(x-110,y+245,10,20,90);
    elli(x-105,y+220,10,20,45);
    elli(x-100,y+190,8,16,135);
    elli(x-75,y+210,8,16,-45);
    /*画中间的叶子*/
    elli(x+65,y+190,10,20,-45);
    elli(x+40,y+185,8,16,0);
    elli(x+55,y+165,8,16,90);
    }

    /*主程序*/
    main()
    {
    int driver=VGA,mode=VGAHI;
    initgraph(&driver,&mode,"C:\TC");
    cleardevice();
    hua(450,90);
    setcolor(2);
    rectangle(0,0,639,479);
    getch();
    closegraph();
    }
    /*饿罗斯方快封面*/
    #include stdlib.h  
    #include stdio.h  
    #include graphics.h
    #define SIZE 16
    unsigned char zimo[23][32]= /*封面中文字的字模*/{{0x8,0x20,0x9,0xa8,0xf,0x24,0x11,0x20,0x11,0x24,0x3f,0xfe,0x51,0x20,0x91,0x20,0x11,0xa4,0x13,0x18,0x1d,0x10,0x11,0x30,0x11,0x48,0x11,0xa,0x15,0x6,0x12,0x2}
    ,{0x0,0x4,0x7f,0xfe,0x44,0x44,0x44,0x44,0x44,0x44,0x7f,0xfc,0x42,0x4,0x2,0x0,0x7,0xf0,0x8,0x10,0x14,0x20,0x62,0xc0,0x1,0x0,0x6,0x0,0x18,0x0,0xe0,0x0}
    ,{0x22,0x8,0x22,0x1c,0x7f,0x60,0x22,0x40,0x22,0x40,0x3e,0x40,0x22,0x7e,0x22,0x48,0x3e,0x48,0x22,0x48,0x22,0x48,0xff,0x48,0x0,0x88,0x14,0x88,0x23,0x8,0x42,0x8}
    ,{0x4,0x0,0x3,0x0,0x1,0x0,0x0,0x4,0xff,0xfe,0x4,0x0,0x4,0x10,0x7,0xf8,0x4,0x10,0x4,0x10,0x4,0x10,0x8,0x10,0x8,0x10,0x10,0x10,0x20,0xa0,0x40,0x40}
    ,{0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x88,0x13,0xfc,0xfc,0x88,0x10,0x88,0x10,0x88,0x10,0x88,0x17,0xfe,0x10,0x80,0x1d,0x40,0xf1,0x20,0x42,0x10,0x4,0xe,0x8,0x4}
    ,{0x9,0x0,0x9,0x0,0x9,0x4,0x11,0xfe,0x12,0x80,0x32,0x80,0x54,0x90,0x98,0xf8,0x10,0x80,0x10,0x80,0x10,0x88,0x10,0xfc,0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80}
    ,{0x2,0x0,0x2,0x10,0x3f,0xe0,0x2,0x20,0x2,0x44,0xff,0xfe,0x1,0x0,0x2,0x0,0xf,0xf0,0x18,0x10,0x28,0x10,0x4f,0xf0,0x88,0x10,0x8,0x10,0xf,0xf0,0x8,0x10}
    ,{0x0,0x8,0x7f,0xfc,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x10,0x3f,0xf8,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x4,0xff,0xfe,0x0,0x0}
    ,{0x2,0x0,0x2,0x10,0x3f,0xe0,0x2,0x20,0x2,0x44,0xff,0xfe,0x1,0x0,0x2,0x0,0xf,0xf0,0x18,0x10,0x28,0x10,0x4f,0xf0,0x88,0x10,0x8,0x10,0xf,0xf0,0x8,0x10}
    ,{0x0,0x0,0x7c,0x88,0x44,0x48,0x54,0x50,0x55,0xfc,0x55,0x24,0x55,0xac,0x55,0x24,0x55,0xfc,0x54,0x0,0x54,0xf8,0x54,0x88,0x20,0xf8,0x28,0x88,0x44,0xf8,0x80,0x88}
    ,{0x2,0x8,0x41,0x10,0x30,0xa0,0x17,0xfc,0x0,0x40,0x0,0x40,0xf0,0x44,0x17,0xfe,0x10,0x40,0x10,0x40,0x10,0x80,0x10,0xa0,0x11,0x18,0x2a,0x8,0x44,0x0,0x3,0xfe}
    ,{0x0,0x4,0x7f,0xfe,0x40,0x4,0x42,0xc,0x62,0x8c,0x54,0x54,0x54,0x54,0x48,0x24,0x48,0x24,0x54,0x54,0x52,0x4c,0x62,0x8c,0x61,0x4,0x42,0x4,0x40,0x14,0x40,0x8}
    ,{0x4,0x0,0x4,0x0,0x4,0x4,0xff,0xfe,0x4,0x0,0x4,0x0,0xf,0xf0,0x8,0x10,0x14,0x20,0x12,0x20,0x21,0x40,0x40,0x80,0x81,0x40,0x6,0x30,0x18,0xe,0x60,0x4}
    ,{0x8,0x20,0x8,0x24,0xff,0xfe,0x8,0x20,0x4,0x80,0x24,0xfc,0x25,0x0,0x26,0x40,0x24,0x20,0x4,0x20,0x3f,0xf8,0x24,0x48,0x24,0x48,0x24,0x48,0xff,0xfe,0x0,0x0}
    ,{0x0,0x40,0x40,0x48,0x27,0xfc,0x20,0x40,0x3,0xf8,0xe0,0x40,0x2f,0xfe,0x20,0x0,0x23,0xf8,0x22,0x8,0x23,0xf8,0x22,0x8,0x2b,0xf8,0x32,0x8,0x22,0x28,0x2,0x10}
    ,{0x10,0x40,0x10,0x20,0x10,0x0,0x13,0xfe,0xfa,0x2,0x14,0x44,0x10,0x40,0x1b,0xfe,0x30,0x88,0xd0,0x88,0x11,0x10,0x10,0x90,0x10,0x60,0x10,0x50,0x50,0x8c,0x23,0x4}
    ,{0x8,0x0,0x8,0x18,0xb,0xe0,0x10,0x40,0x10,0x40,0x30,0x40,0x50,0x44,0x9f,0xfe,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x40,0x10,0x48,0x17,0xfc,0x10,0x0,0x10,0x0}
    ,{0x1,0x0,0x3f,0xf8,0x8,0x20,0x4,0x44,0xff,0xfe,0x0,0x0,0x1f,0xf0,0x10,0x10,0x1f,0xf0,0x10,0x10,0x1f,0xf0,0x2,0x0,0x51,0x84,0x50,0x92,0x90,0x12,0xf,0xf0}
    ,{0x20,0x10,0x27,0x10,0x39,0x7c,0x41,0x14,0x82,0xfe,0x7a,0x14,0x24,0x7c,0x27,0x10,0xf9,0x7c,0x21,0x10,0x25,0x10,0x22,0xfe,0x2a,0x10,0x35,0x10,0x28,0x90,0x0,0x7e}
    {0x2,0x20,0x42,0x20,0x22,0x20,0x2f,0xfc,0x2,0x20,0x2,0x20,0xe2,0x20,0x22,0x24,0x2f,0xfe,0x22,0x20,0x22,0x20,0x22,0x20,0x24,0x20,0x50,0x20,0x8f,0xfe,0x0,0x0}
    ,{0x4,0x0,0x2,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x2,0x80,0x2,0x80,0x2,0x80,0x4,0x40,0x4,0x40,0x8,0x20,0x8,0x20,0x10,0x10,0x20,0x10,0x40,0xe,0x80,0x4}
    ,{0x2,0x10,0x41,0x10,0x20,0x1e,0x2f,0xe0,0x82,0x40,0x62,0x3e,0x23,0x84,0xa,0x88,0x12,0x88,0x22,0xfe,0xe2,0x88,0x24,0x88,0x24,0x88,0x28,0x88,0x31,0xa8,0x20,0x10}
    ,{0x0,0x40,0x0,0x50,0x7e,0x48,0x2,0x40,0x43,0xfe,0x24,0x40,0x14,0x44,0x14,0x44,0x8,0x48,0x14,0x48,0x12,0x50,0x22,0x20,0x40,0x60,0x80,0x92,0x1,0xa,0x2,0x6}};
    main()
    {
    int driver=DETECT,mode,i,x,y,banjin=SIZE,aaa=0,bbb=-1;
    initgraph(&driver,&mode,"c:\tc");
    randomize();
    setcolor(GREEN);
    biankuang(0);
    biankuang(6);
    setbkcolor(BLUE);
    setcolor(BLUE);
    setpalette(YELLOW,YELLOW);
    pingbi(zimo[0],80,110);
    pingbi(zimo[1],240,110);
    pingbi(zimo[2],400,110);
    pingbi(zimo[3],160,240);
    pingbi(zimo[4],320,240);
    for(i=0;i2;i++)
    { xiezi(zimo[i+5],100+20*i,580);
    xiezi(zimo[i+7],150+20*i,580);}
    for(i=0;i9;i++)
    xiezi(zimo[i+14],100+20*i,10);
    setpalette(DARKGRAY,BLACK);
    setbkcolor(DARKGRAY);
    while(1)
    { if(kbhit())goto label;
    if(aaa==0)
    {while(1){
    x=random(600)+16;
    y=random(440)+16;
    if(!(y=70&&y=410))break;
    }}

    for(i=0;i=SIZE;i++ )
    { bbb++;
    bbb=bbb%63;
    setpalette(BLUE,63-bbb);
    setpalette(YELLOW,bbb);
    if(aaa==0)
    {pingpu(x,y,banjin);
    setcolor(WHITE);
    setfillstyle(SOLID_FILL,WHITE);  
    arc((x+SIZE)-(SIZE-i),(y-SIZE)+(SIZE-i),180,270,banjin-(SIZE-i));
    arc((x-SIZE)+(SIZE-i),(y-SIZE)+(SIZE-i),270,360,banjin-(SIZE-i));
    arc((x-SIZE)+(SIZE-i),(y+SIZE)-(SIZE-i),0,90,banjin-(SIZE-i));
    arc((x+SIZE)-(SIZE-i),(y+SIZE)-(SIZE-i),90,180,banjin-(SIZE-i));
    floodfill(x,y,WHITE);
    delay(500);if(i==SIZE)aaa=1;}
    if(aaa==1)
    {pingpu(x,y,banjin);
    setcolor(WHITE);
    setfillstyle(SOLID_FILL,WHITE);
    arc((x+SIZE)-i,(y-SIZE)+i,180,270,banjin-i);
    arc((x-SIZE)+i,(y-SIZE)+i,270,360,banjin-i);
    arc((x-SIZE)+i,(y+SIZE)-i,0,90,banjin-i);
    arc((x+SIZE)-i,(y+SIZE)-i,90,180,banjin-i);
    floodfill(x,y,WHITE);
    delay(500);if(i==SIZE)aaa=0;}
    }}
    label:
    setpalette(BLUE,BLUE);
    setpalette(YELLOW,YELLOW);
    closegraph();
    }
    xingxing(int x,int y) /*根据坐标花五角星*/
    {
    int a[]={4,0,5,2,8,2,6,4,7,7,4,5,1,7,2,4,0,2,3,2,4,0},i;
    for(i=0;i22;i++)
    { a=a;
    if(i%2==0)a=a+x;
    else a=a+y;
    }
    drawpoly(11,a);
    setfillstyle(SOLID_FILL,YELLOW);
    floodfill(a[0],a[1]+4,BLUE);
    }
    unsigned char a[]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
    pingbi(unsigned char *ch,int x,int y) /*根据字模在指定的坐标画出由星星所组成的文字*/
    {
    int i,j,n=-1;
    for(i=0;i32;i++)
    { if(i%2==0)n++;
    if(i%2==0)
    { for(j=0;j8;j++)
    if(ch&a[j])
    xingxing(j*9+x,y+n*8); }
    else
    { for(j=8;j16;j++)
    if(ch&a[j-8])
    xingxing(j*9+x,y+n*8);}
    }
    }

    biankuang(int x)
    {
    setcolor(WHITE);
    rectangle(70-x,100-x,570+x,380+x);
    rectangle(72-x,102-x,568+x,378+x);
    setcolor(LIGHTGREEN);
    line(70-x,100-x,570+x,100-x);
    line(70-x,100-x,70-x,380+x);
    line(568+x,102-x,568+x,378+x);
    line(568+x,378+x,72-x,378+x);
    }

    xiezi(unsigned char *ch,int x,int y)/*根据字模在指定的坐标上写字*/
    {
    int i,j;

    for(i=0;i32;i++)
    { if(i%2==0){
    for(j=0;j8;j++)
    if(ch&a[j])
    putpixel(y+j,x+i/2,LIGHTRED);
    }
    else{
    for(j=8;j16;j++)
    if(ch&a[j-8])
    putpixel(y+j,x+i/2,LIGHTRED);}
    }
    }

    pingpu(int x,int y,int banjin) /*把显示出来的部分画面,用背景色填充*/
    {
    setcolor(DARKGRAY);
    setfillstyle(SOLID_FILL,DARKGRAY);
    bar(x-banjin,y-banjin,x+banjin,y+banjin);
    }


    #includedos.h
    #includeconio.h
    #includemath.h

    main()
    { int i,j;
    int heart[104][121] = {0};
    union REGS inregs,ouegs;
    unsigned char far *buffer = (char far *)0xA0000000L;
    for(j = 89;j = 95;j++)
    heart[0][j] = 1;
    for(j = 20;j = 33;j++)
    heart[1][j] = 1;
    for(j = 84;j = 101;j++)
    heart[1][j] = 1;
    for(j = 15;j = 37;j++)
    heart[2][j] = 1;
    for(j = 81;j = 103;j++)
    heart[2][j] = 1;
    for(j = 12;j = 42;j++)
    heart[3][j] = 1;
    for(j = 78;j = 106;j++)
    heart[3][j] = 1;
    for(j = 11;j = 45;j++)
    heart[4][j] = 1;
    for(j = 77;j = 107;j++)
    heart[4][j] = 1;
    for(j = 10;j = 49;j++)
    heart[5][j] = 1;
    for(j = 73;j = 109;j++)
    heart[5][j] = 1;
    for(j = 9;j = 50;j++)
    heart[6][j] = 1;
    for(j = 71;j = 110;j++)
    heart[6][j] = 1;
    for(j = 7;j = 54;j++)
    heart[7][j] = 1;
    for(j = 69;j = 112;j++)
    heart[7][j] = 1;
    for(j = 6;j = 55;j++)
    heart[8][j] = 1;
    for(j = 67;j = 113;j++)
    heart[8][j] = 1;
    for(j = 5;j = 58;j++)
    heart[9][j] = 1;
    for(j = 65;j = 114;j++)
    heart[9][j] = 1;
    for(j = 4;j = 59;j++)
    heart[10][j] = 1;
    for(j = 63;j = 115;j++)
    heart[10][j] = 1;
    for(j = 4;j = 60;j++)
    heart[11][j] = 1;
    for(j = 62;j = 116;j++)
    heart[11][j] = 1;
    for(j = 3;j = 116;j++)
    heart[12][j] = 1;
    for(j = 3;j = 117;j++)
    heart[13][j] = 1;
    for(j = 3;j = 117;j++)
    heart[14][j] = 1;
    for(j = 2;j = 118;j++)
    heart[15][j] = 1;
    for(j = 2;j = 118;j++)
    heart[16][j] = 1;
    for(j = 1;j = 118;j++)
    heart[17][j] = 1;
    for(j = 1;j = 118;j++)
    heart[18][j] = 1;
    for(j = 1;j = 119;j++)
    heart[19][j] = 1;
    for(j = 1;j = 119;j++)
    heart[20][j] = 1;
    for(j = 1;j = 119;j++)
    heart[21][j] = 1;
    for(j = 0;j = 120;j++)
    heart[22][j] = 1;
    for(j = 1;j = 120;j++)
    heart[23][j] = 1;
    for(j = 1;j = 120;j++)
    heart[24][j] = 1;
    for(j = 0;j = 120;j++)
    heart[25][j] = 1;
    for(j = 0;j = 120;j++)
    heart[26][j] = 1;
    for(j = 0;j = 120;j++)
    heart[27][j] = 1;
    for(j = 0;j = 120;j++)
    heart[28][j] = 1;
    for(j = 0;j = 120;j++)
    heart[29][j] = 1;
    for(j = 0;j = 120;j++)
    heart[30][j] = 1;
    for(j = 1;j = 120;j++)
    heart[31][j] = 1;
    for(j = 1;j = 119;j++)
    heart[32][j] = 1;
    for(j = 1;j = 119;j++)
    heart[33][j] = 1;
    for(j = 0;j = 119;j++)
    heart[34][j] = 1;
    for(j = 0;j = 119;j++)
    heart[35][j] = 1;
    for(j = 1;j = 119;j++)
    heart[36][j] = 1;
    for(j = 1;j = 119;j++)
    heart[37][j] = 1;
    for(j = 1;j = 118;j++)
    heart[38][j] = 1;
    for(j = 2;j = 118;j++)
    heart[39][j] = 1;
    for(j = 3;j = 118;j++)
    heart[40][j] = 1;
    for(j = 3;j = 118;j++)
    heart[41][j] = 1;
    for(j = 3;j = 118;j++)
    heart[42][j] = 1;
    for(j = 3;j = 118;j++)
    heart[43][j] = 1;
    for(j = 4;j = 117;j++)
    heart[44][j] = 1;
    for(j = 4;j = 117;j++)
    heart[45][j] = 1;
    for(j = 4;j = 117;j++)
    heart[46][j] = 1;
    for(j = 5;j = 116;j++)
    heart[47][j] = 1;
    for(j = 5;j = 116;j++)
    heart[48][j] = 1;
    for(j = 5;j = 116;j++)
    heart[49][j] = 1;
    for(j = 6;j = 116;j++)
    heart[50][j] = 1;
    for(j = 7;j = 116;j++)
    heart[51][j] = 1;
    for(j = 7;j = 116;j++)
    heart[52][j] = 1;
    for(j = 8;j = 115;j++)
    heart[53][j] = 1;
    for(j = 8;j = 115;j++)
    heart[54][j] = 1;

    for(j = 9;j = 115;j++)
    heart[55][j] = 1;
    for(j = 10;j = 114;j++)
    heart[56][j] = 1;
    for(j = 10;j = 114;j++)
    heart[57][j] = 1;
    for(j = 10;j = 114;j++)
    heart[58][j] = 1;
    for(j = 11;j = 114;j++)
    heart[59][j] = 1;
    for(j = 11;j = 113;j++)
    heart[60][j] = 1;
    for(j = 12;j = 112;j++)
    heart[61][j] = 1;
    for(j = 13;j = 111;j++)
    heart[62][j] = 1;
    for(j = 13;j = 111;j++)
    heart[63][j] = 1;
    for(j = 14;j = 110;j++)
    heart[64][j] = 1;
    for(j = 15;j = 110;j++)
    heart[65][j] = 1;
    for(j = 16;j = 110;j++)
    heart[66][j] = 1;
    for(j = 17;j = 109; j++)
    heart[67][j] = 1;
    for(j = 17;j = 108;j++)
    heart[68][j] = 1;
    for(j = 18;j = 107;j++)
    heart[69][j] = 1;
    for(j = 19;j = 107;j++)
    heart[70][j] = 1;
    for(j = 20;j = 106;j++)
    heart[71][j] = 1;
    for(j = 21;j = 106;j++)
    heart[72][j] = 1;
    for(j = 21;j = 106;j++)
    heart[73][j] = 1;
    for(j = 22;j = 105;j++)
    heart[74][j] = 1;
    for(j = 23;j = 105;j++)
    heart[75][j] = 1;
    for(j = 24;j = 104;j++)
    heart[76][j] = 1;
    for(j = 25;j = 103;j++)
    heart[77][j] = 1;
    for(j = 26;j = 102;j++)
    heart[78][j] = 1;
    for(j = 27;j = 100;j++)
    heart[79][j] = 1;
    for(j = 28;j = 100;j++)
    heart[80][j] = 1;
    for(j = 28;j = 98;j++)
    heart[81][j] = 1;
    for(j = 29;j = 97;j++)
    heart[82][j] = 1;
    for(j = 31;j = 97;j++)
    heart[83][j] = 1;
    for(j = 33;j = 96;j++)
    heart[84][j] = 1;
    for(j = 33;j = 96;j++)
    heart[85][j] = 1;
    for(j = 36;j = 94;j++)
    heart[86][j] = 1;
    for(j = 36;j = 93;j++)
    heart[87][j] = 1;
    for(j = 37;j = 92;j++)
    heart[88][j] = 1;
    for(j = 38;j = 91;j++)
    heart[89][j] = 1;
    for(j = 40;j = 90;j++)
    heart[90][j] = 1;
    for(j = 41;j = 90;j++)
    heart[91][j] = 1;
    for(j = 42;j = 88;j++)
    heart[92][j] = 1;
    for(j = 43;j = 87;j++)
    heart[93][j] = 1;
    for(j = 46;j = 86;j++)
    heart[94][j] = 1;
    for(j = 46;j = 84;j++)
    heart[95][j] = 1;
    for(j = 49;j = 80;j++)
    heart[96][j] = 1;
    for(j = 49;j = 77;j++)
    heart[97][j] = 1;
    for(j = 52;j = 76;j++)
    heart[98][j] = 1;
    for(j = 52;j = 76;j++)
    heart[99][j] = 1;
    for(j = 56;j = 74;j++)
    heart[100][j] = 1;
    for(j = 58;j = 72;j++)
    heart[101][j] = 1;
    for(j = 61;j = 66;j++)
    heart[102][j] = 1;
    heart[103][65] = 1;

    inregs.h.ah = 0;
    inregs.h.al = 0x13;
    int86(0x10,&inregs,&ouegs);
    while(!kbhit())
    { for(i = 0;i = 103;i++)
    for(j = 0;j = 120;j++)
    if(heart[j])
    buffer[((i+50)  8)+
    ((i+50)  6)+j+100] = (int)(130 * cos(i) * cos(j) +sin(i) * sin (j));
    }
    inregs.h.ah = 0;
    inregs.h.al = 0x03;
    int86(0x10,&inregs,&ouegs);
    }
    /*------曼德勃罗特集---*/
    #include graphics.h
    main(){
    int nThre=100; /* 其中nThre代表设置的门限值,当迭代后Z的幅值的平方大于nThre则认为趋于无穷*/
    int xCord,yCord,nColor,nTimes; /*xCord和yCord分别代表平面上的点的坐标位置,nColor代表作图时所使用的颜色,nTimes表示迭代的次数 */
    float reP,rePmin=-1.5,rePmax=0.75; /*reP表示由平面上一点所代表的μ值的实部,rePmax、rePmin分别代表μ值实部可取的最大值和最小值*/
    float imP,imPmin=-1.5,imPmax=1.5; /*imP、imPmax和imPmin分别代表μ的虚部及其容许的最大值和最小值*/
    float reZ,imZ,tmpReZ,deltImP,deltReP,absZ;
    /*reZ和imZ分别代表Z值的实部和虚部,deltImP、deltReP表示每一个象素的代表的实部和虚部值的大小,absZ代表Z值的幅值 */
    int GraphDriver=DETECT,GraphMode; /*初始化图形显示**/
    initgraph(&GraphDriver,&GraphMode,"c:\tc");
    deltReP=(rePmax-rePmin)/640; /*计算屏幕上一个像素表*/
    deltImP=(imPmax-imPmin)/480; /*和虚部值的大小示的 */
    for(xCord=1;xCord641;xCord++)
    for (yCord=1;yCord481;yCord++){
    reP=rePmin+deltReP*xCord; /*计算屏幕上一点所*/
    imP=imPmin+deltImP*yCord;/*代表的μ值大小*/
    reZ=0; imZ=0;
    for(nTimes=0;nTimes160;nTimes++){
    tmpReZ=reZ*reZ-imZ*imZ+reP; /*计算迭代后的Z*/
    imZ=2*reZ*imZ+imP;/*值及其幅值大小*/
    reZ=tmpReZ;absZ=reZ*reZ+imZ*imZ;
    if (absZnThre){nColor=nTimes/10;break;}
    /*如果幅值的平方大于门限值终止迭代*/
    nColor=0;}
    putpixel(xCord,yCord,nColor); }/*用指定的颜色作点*/
    getch();
    }
    

    /*
    #includemath.h
    #includegraphics.h
    void main()
    {
    float t;
    int x0=320,y0=240;
    int n,i,j,r;
    int x[50],y[5];
    int gdriver=DETECT,gmode;
    printf("input n(23-31)and r(100-200)n"); /*读入表示图形复杂度大小的设置参数*/
    scanf("%d %d",&n,&r);
    initgraph(&gdriver,&gmode,"c:\tc"); /*设置图形方式初始化*/
    cleardevice(); /*清屏*/
    setbkcolor(WHITE); /*设置缘景为白色*/
    setcolor(RED); /*设置绘图色为红色*/
    t=6.28318/n;
    for(i=0;in;i++) /*利用数学公式计算端点坐标值*/
    { x=r*cos(i*t)+x0;
    y=r*sin(i*t)+y0;
    }
    for(i=0;i=n-1;i++) /*根据端点值画线*/
    { for(j=i+1;j=n-1;j++)
    {if(i-j)
    line(x,y,x[j],y[j]);
    }
    }
    getch();
    closegraph();
    exit(0);
    }

    楼主 2016-02-05 18:55 回复

共有回帖数 0
  • 回 帖
  • 表情 图片 视频
  • 发表

登录直线网账号

Copyright © 2010~2015 直线网 版权所有,All Rights Reserved.沪ICP备10039589号 意见反馈 | 关于直线 | 版权声明 | 会员须知