#include<graphics.h>
#include<conio.h>
#include<math.h>
#include<dos.h>
#include<stdlib.h>
void star(float xo,float yo,float a,int ic,int style);
main()
{
int gd=DETECT,gomde,i;
float xc,yc,ra,rd=3.1415926/180.;
initgraph(&gd,&gomde,"c:\\JMSOFT\\DRV");
settextstyle(1,0,3);
settextjustify(CENTER_TEXT,TOP_TEXT);
outtextxy(320,2,"Pentagon Dispaly");
star(320.,250.,400.,4,1);
getch();
cleardevice();
for(i=1;i<=11;i++)
{
star(320.,265.,400.,i,i);
}
getch();
cleardevice();
outtextxy(320,2,"Changing fillstyle pentagon display.");
for(i=1;i<=11;i++)
{
ra=480.-i*30;
star(320,265,ra,i,i);
}
getch();
cleardevice();
outtextxy(320,2,"Changing fillstyle pentagon display.");
for(i=1;i<=11;i++)
{
ra=480.-i*35;
star(320,265,ra,i,1);
}
getch();
cleardevice();
outtextxy(320,2,"Changing fillstyle pentagon display.");
for(i=1;i<=11;i++)
{
ra=480.-i*35;
star(320,265,ra,i,0);
}
getch();
cleardevice();
outtextxy(320,2,"Moving pentagon display");
for(i=1;i<=11;i++)
{
ra=480.-i*30;
xc=420.-i*25;
yc=265+i*5;
star(xc,yc,ra,i,i);
}
getch();
cleardevice();
outtextxy(320,2,"Moving pentagon display");
for(i=1;i<=11;i++)
{
setbkcolor(14-i);
ra=480.-i*30;
xc=420.-i*25;
yc=265+i*5;
star(xc,yc,ra,i,i+4);
}
getch();
cleardevice();
setbkcolor(0);
outtextxy(320,2,"Moving pentagon display");
for(i=1;i<=11;i++)
{
ra=480.-i*30;
xc=420.-i*25;
yc=265+i*5;
star(xc,yc,ra,i,0);
}
getch();
cleardevice();
for(;;)
{
star(random(630),random(470),random(200),random(15),random(11));
if(kbhit())
break;
}
getch();
cleardevice();
setbkcolor(LIGHTBLUE);
setfillstyle(SOLID_FILL,RED);
bar(10,40,625,430);
star(100.,130.,50.,14,1);
for(i=0;i<4;i++);
{
xc=100+140*cos((340+i*15)*rd);
yc=130+140*sin((340+i*15)*rd);
star(xc,yc,25.,14,1);
}
getch();
closegraph();
}
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
#define RAND_SIZE 50
void star(float xo,float yo,float a,int ic,int style);
int main()
{
int gd=DETECT,gmode;
int i,j,k,x0,y0,star_size=40;
size_t size;
void far*bitmap;
printf("Please the size of star cell<20,40,60,or 80>:\n");
scanf("%d",&star_size);
initgraph(&gd,&gmode,"c:\\JMSOFT\\DRV");
/*移动的动画*/
for(j=0;j<((getmaxy()+1)/star_size);j++)
{
y0=j*star_size;
star((float)(star_size/2),(float)(y0+star_size/2),(float)star_size,getmaxcolor()-j,SOLID_FILL);
size=imagesize(0,y0,star_size,y0+star_size);
bitmap=malloc(size);
getimage(0,y0,star_size,y0+star_size,bitmap);
for(k=((getmaxx()+1)/star_size);k>1;k--)
{
for(i=1;i<k;i++)
{
x0=i*star_size-1;
putimage(x0,y0,bitmap,XOR_PUT);
putimage(x0,y0,bitmap,XOR_PUT);
}
putimage(x0,y0,bitmap,COPY_PUT);
}
}
delay(1000);
cleardevice();
/*垂直方向*/
for(j=0;j<((getmaxx()+1)/star_size);j++)
{
x0=j*star_size;
star((float)(x0+star_size/2),(float)(star_size/2),(float)star_size,getmaxcolor()-j,SOLID_FILL);
size=imagesize(x0,0,x0+star_size,star_size);
bitmap=malloc(size);
getimage(x0,0,x0+star_size,star_size,bitmap);
for(k=((getmaxxy()+1)/star_size);k>1;k--)
{
for(i=1;i<k;i++)
{
y0=i*star_size-1;
putimage(x0,y0,bitmap,XOR_PUT);
delay(10);
putimage(x0,y0,bitmap,XOR_PUT);
delay(5);
}
putimage(x0,y0,bitmap,COPY_PUT);
}
}
getch();
closegraph();
return 1;
}
#include<stdio.h>
#include<stdlib.h>
#include<bios.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
#include<conio.h>
#define ESC_KEY Ox011b
#define RAND_SIZE 50
#define DELAY_TIME 88
void MyStar(float xO,float y0,float d,float a,unsigned int n,int ic);
void RoteStar(float x0,float yO,float db,float ds,int ic);
int CycleColor();
void WipeScreen(int ic);
int star_num=5;
int main()
{
int i,j,k,x0,y0,star_size=40,wipecolor=WHITE;
int gd=DETECT,gmode;
void *bitmap;
long start,end;
size_t size;
printf("Please select the size of star cell<20.40,60,or 80>:\n");
scanf("%d",&star_size);
printf("and the star type [>3]:\n");
scanf("%d",&star_num);
printf("and wipe color [WHITE:15]:\n");
scanf("%d",&wipecolor);
initgraph(&gd,&gmode,"C:\\JMSOFT\\DRV");
size=imagesize(0,0,star_size,star_size);
bitmap=malloc(size);
settextjustify(CENTER_TEXT,TOP_TEXT);
for(j=0;j<((getmaxxy()+1)/star_size);j++)
{
y0=j*star_size;
MyStar((float)(star_size/2),(float)(y0+star_size/2),(float)star_size/2,0,star_num,getmaxcolor()-j);
getimage(0,y0,star_size,y0+star_size,bitmap);
for(k=((getmaxx()+1)/star_size);k>1;k--)
{
for(i=1;i<k;i++)
{
x0=i*star_size-1;
putimage(x0,y0,bitmap,XOR_PUT);
putimage(x0,y0,bitmap,XOR_PUT);
}
putimage(x0,y0,bitmap,COPY_PUT);
}
}
delay(1000);
cleardevice();
for(j=0;j<((getmaxx()+1)/star_size);j++)
{
x0=j==0?j*star_size:j*star_size-1;
MyStar((float)(x0+star_size/2),(float)(star_size/2),(float)star_size/2,0,star_num,getmaxcolor()-j);
getimage(x0,0,x0+star_size,star_size,bitmap);
for(k=((getmaxy()+1)/star_size);k>1;k--)
{
for(i=1;i<k;i++)
{
y0=i*star_size;
putimage(x0,y0,bitmap,XOR_PUT);
delay(10);
putimage(x0,y0,bitmap,XOR_PUT);
delay(5);
}
putimage(x0,y0,bitmap,COPY_PUT);
}
}
delay(1000);
free(bitmap);
randomize();
while(1)
{
x0=random(getmaxx()-RAND_SIZE);
y0=random(getmaxy()-RAND_SIZE);
i=random(RAND_SIZE),j=random(RAND_SIZE);
size=imagesize(x0,y0,x0+i,y0+j);
bitmap=malloc(size);
getimage(x0,y0,x0+i,y0+j,bitmap);
putimage(x0,y0,bitmap,NOT_PUT);
if(kbhit())
{
getch();
break;
}
free(bitmap);
}
cleardevice();
RoteStar(320,240,150,40,4);
delay(1000);
cleardevice();
RoteStar(320,240,80,30,6);
RoteStar(80,80,40,15,6);
RoteStar(80,getmaxy()-80,40,15,6);
RoteStar(getmaxx()-80,80,40,15,6);
RoteStar(getmaxx()-80,getmaxy()-80,40,15,6);
delay(1000);
cleardevice();
settextstyle(1,0,5);
outtextxy(getmaxx()/2,2,"Sprinkle Olympics Tours");
RoteStar(150,190,80,15,12);
RoteStar(310,190,80,15,8);
RoteStar(470,190,80,15,9);
RoteStar(230,320,80,15,10);
RoteStar(390,320,80,15,11);
WipeScreen(wipecolor);
delay(1500);
settexestyle(1,0,5);
setcolor(WHITE);
setfillstyle(SOLID_FILL,BLACK);
bar(200,70,470,170);
setfillstyle(SOLID_FILL,LIGHTBLUE);
bar(180,50,450,150);
outtextxy(315,70,"Good Bye!");
setfillstyle(SOLID_FILL,BLACK);
bar(185,250,485,350);
setfillstyle(SOLID_FILL,BLUE);
bar(165,230,465,330);
outtextxy(310,250,"Good Luck!");
settextstyle(1,0,4);
setfillstyle(SOLID_FILL,BLACK);
bar(12,400,638,460);
setfillstyle(SOLID_FILL,BLUE);
bar(2,390,628,450);
outtextxy(310,395,"Xi'an Jiaotong University-CAD Center!");
delay(2000);
getch();
closegraph();
return 0;
}
实验目的:用C++语言设计出大小不同的n角星沿水平方向或垂直方向移动,或者围绕着中央的星星环游及组成奥运五环的形状
这个程序感觉像是三个程序直接拼在一起的,但是我不知道该怎么改
你贴的三个是一摸一样的吧,其实就是一个程序。