int main() { int gdriver = DETECT,gmode,errorcode; initgraph(&gdriver,&gmode,""); polyfill p; p.getdata(); p.fillpol(); getch(); closegraph(); return 0; }
int main(void) { setinitmode(INIT_DEFAULT|INIT_NOFORCEEXIT); initgraph(640, 480); randomize(); setrendermode(RENDER_MANUAL); mainloop(); closegraph(); return 0; }
int main(void) { setinitmode(INIT_ANIMATION); // 图形初始化,窗口尺寸640x480 initgraph(640, 480); // 随机数初始化,如果需要使用随机数的话 randomize(); // 程序主循环 mainloop(); // 关闭绘图设备 closegraph(); return 0; }
int main(){ int gd = DETECT , gm ; int a,i, n,r=40; double rotate_angle = 0 , t = 0; // inputs printf("Enter radius and spokes\n"); scanf("%d %d",&r,&n); // initialization graphs initgraph(&gd,&gm,""); setcolor(3); a = xc + r; while(!kbhit()){ while(a<=630){ // so as to ensure that the wheel doesnt run out of the page t = pi*rotate_angle / 180; cleardevice(); circle(xc,yc,r); // use polar coordinates to rotate.. !! for(i=0;i<n;i++,rotate_angle+=360/n){ // now moving of wheel takes place in two steps;;; // rotation and translation // note: only the center of mass of any circular body will undergo translation motion // whereas the boundary of the body will undergo rotation motion. // we are first finding the angle by which each spoke rotaotes and the we rotate the spoke t = pi*rotate_angle/180; x[i] = xc+ r*cos(t); y[i] = yc + r*sin(t); line(xc,yc,x[i],y[i]); } rotate_angle+=2; // for next frame ,, ... xc+=2; // translating the center of circle a=xc+r; delay(20); } // xc = 100 ; a = xc+r; // uncomment this line if u wanna continous rotation } getchar(); closegraph(); }
int main() { { TEXTO a(GOTHIC_FONT,VERT_DIR,10,"Turbo"); textoColor b(TRIPLEX_FONT,HORIZ_DIR,10,"Pascal",LIGHTBLUE); textoAmpliar c(SANS_SERIF_FONT,HORIZ_DIR,10,"Lenguaje", LIGHTRED,5,1,10,1); int i=23; TEXTO *p; textoColor *q; textoAmpliar *r; int *s; char s1[10]; int unidad=DETECT,modo; initgraph (&unidad,&modo,"c:\\bc\\bgi"); if (graphresult() != 0) { cout << "Error al tratar de pasar al modo grafico\n"; getch(); return 1; } p = &a; q = &b; r = &c; s = &i; p->escribir(); getch(); q->escribir(); getch(); r->escribir(); getch(); clearviewport(); settextstyle (DEFAULT_FONT,HORIZ_DIR,0); itoa (*s,s1,10); outtext(s1); getch(); clearviewport(); } // Aqui se destruyen los objetos en el siguiente orden: // 1) El destructor de la clase derivada // 2) El destructor de la clase base // Favor estudiar numeral 12.2 getch(); closegraph(); return 0; }
void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"C:\\tc\\bgi"); char ch='a'; int length=5; // Set initial length of snake as 3 //int lmax=10; //max length int radius=10; int xPosition[lmax],yPosition[lmax]; for(int i=0;i<length;i++) { xPosition[i]=100+i*2*radius; yPosition[i]=100; } draw(xPosition,yPosition,length,radius); char temp=ch,temp2; while(ch!='p') { temp2=getch(); if(temp=='a' && temp2=='d') { ch=temp; } else if(temp=='d' && temp2=='a') { ch=temp; } else if(temp=='w' && temp2=='x') { ch=temp; } else if(temp=='x' && temp2=='w') { ch=temp; } else { ch=temp2; } temp=ch; cleardevice(); assignPosition(xPosition,yPosition,length,ch,radius); draw(xPosition,yPosition,length,radius); /*for(i=0;i<length;i++) { printf("%d %d for %d \n ",xPosition[i],yPosition[i],i+1); }*/ } getch(); closegraph(); }
main() { int driver=DETECT,mode,i; static double x1[]={0.0,10.0,80.0,100.0,0.0}; static double y1[]={0.0,50.0,50.0,0.0,0.0}; static double x2[5],y2[5],x3[5],y3[5],x4[5],y4[5]; double x,xx,yy,r; initgraph(&driver,&mode,""); axis(); for(i=0;i<=3;i++){ line(scx(x1[i]),scy(y1[i]),scx(x1[i+1]),scy(y1[i+1])); } scale(2.0); for(i=0;i<=4;i++){ x2[i]=affinex(x1[i],y1[i],1.0); y2[i]=affiney(x1[i],y1[i],1.0); delay(30000); } for(i=0;i<=3;i++){ line(scx(x2[i]),scy(y2[i]),scx(x2[i+1]),scy(y2[i+1])); } r=60; rotate(r); for(i=0;i<=4;i++){ x3[i]=affinex(x2[i],y2[i],1.0); y3[i]=affiney(x2[i],y2[i],1.0); delay(30000); } for(i=0;i<=3;i++){ line(scx(x3[i]),scy(y3[i]),scx(x3[i+1]),scy(y3[i+1])); } palert::el(50.0,-150.0); for(i=0;i<=4;i++){ x4[i]=affinex(x3[i],y3[i],1.0); y4[i]=affiney(x3[i],y3[i],1.0); delay(30000); } for(i=0;i<=3;i++){ line(scx(x4[i]),scy(y4[i]),scx(x4[i+1]),scy(y4[i+1])); } getch(); closegraph(); }
int main() { int gd=DETECT,gm,min=0,maximum=0,c, location,loc, pp, o,m,counter=0,ix,iy,BC,IC,FC; int p[100]; int color=2; double t,m1; DWORD dwWidth = GetSystemMetrics(SM_CXSCREEN); DWORD dwHeight = GetSystemMetrics(SM_CYSCREEN); initwindow(dwWidth,dwHeight); int x0=dwWidth/2; int y0=dwHeight/2; int i,j,x[50],y[50]; double xc[50],yc[50]; for(i=0; i<dwHeight; i++) putpixel(x0,i,RED); for(j=0; j<dwWidth; j++) putpixel(j,y0,RED); int n; printf("Enter the number of coordinates or vertices \n"); scanf("%d",&n); for(i=0;i<n;i++) { printf("Enter the %dth coordinate\n",i+1); scanf("%d",&x[i]); scanf("%d",&y[i]); } for(i=0;i<n;i++) printf("%d\t%d\n",x[i],y[i]); while(z!=(n-1)) { line_draw(x[z],y[z],x[z+1],y[z+1],x0,y0,color); z++; } //Here printf("Enter interior cordinates ix and iy and fill colour \n"); scanf("%d%d%d",&ix,&iy,&IC); boundaryfill4(x0+ix,y0-iy,IC); delay(40000); cleardevice(); closegraph(); }
int main() { int t,i,j,k,gd=DETECT,gm; initgraph(&gd,&gm,NULL); int flag=0; for(i=0;i<400;i++) { cleardevice(); t=15; line(0,450,600,450); line(50+i,400,0+i,450); line(100+i,450,50+i,400); line(50+i,400,50+i,300); line(100+i,350,100+i,200); circle(50+i,280,20); line(50+i,300,100+i,350); line(0+i,350,50+i,300); arc(100+i,200,180,360,100); line(i,200,200+i,200); delay(10); for(j=0;j<450;j+=15) { for(k=0;k<=600;k+=t) { if(k<i||k>(200+i)) { arc(k,j,0,360,1); } if(j<100) { arc(k,j,0,360,1); } } if(flag==0) { delay(10); } } flag = 1; t+=10; if(t==35) { t=15; } } delay(5000); closegraph(); return 0; }
main() //draws some circles with text { int graphdriver = DETECT, graphmode; initgraph(&graphdriver, &graphmode, "..\\bgi"); MCircle Small(250, 100, 25, SANS_SERIF_FONT, "You"); Small.Show(); MCircle Medium(250, 150, 100, TRIPLEX_FONT, "World"); Medium.Show(); MCircle Large(250, 250, 225, GOTHIC_FONT, "Universe"); Large.Show(); getch(); closegraph(); return 0; }
//********************** void Pause(void) { int c; c = getch(); if( ESC == c ){ closegraph(); exit( 1 ); } if( 0 == c ){ c = getch(); } cleardevice(); }
int main() { int gdrive, gmode; char *drvpath = "c:\\bc\\bgi"; detectgraph(&gdrive, &gmode); initgraph(&gdrive, &gmode, drvpath); setbkcolor(0); setcolor(2); cleardevice(); MyOwnFan(320, 230, 0); getch(); closegraph(); return 0; }
void thank() { closegraph(); initwindow(1275,700); setfillstyle(1,1); floodfill(1,1,1); settextstyle(1,0,7); setcolor(10); setbkcolor(1); outtextxy(70,250,"Thankyou for the Purchase"); delay(3000); home(); recommend(10,11); }
int main() { int gdriver = DETECT, gmode, x0, y0, x, xn, yn, i; float m, y; initgraph(&gdriver, &gmode, "C:\\TURBOC3\\BGI"); rectangle(0, 0, MAXX, MAXY); l(20, 20, 300, 300, 10); getch(); closegraph(); return 0; }
main() { int gd = DETECT, gm; int x = 320, y = 240, radius; initgraph(&gd, &gm, "C:\\TC\\BGI"); for ( radius = 25; radius <= 125 ; radius = radius + 20) circle(x, y, radius); getch(); closegraph(); return 0; }
int main() { int gd=DETECT,gm; float y; initgraph(&gd,&gm,0); line(320,0,320,480); line(0,240,640,240); outtextxy(317,210,"-1"); outtextxy(320,240,"0"); outtextxy(317,270,"--1"); sine() ; ncos(); getch(); closegraph(); }
//主页 void MainPage(){ setcliprgn(NULL); int choose = 0; choose = MainMenu(); switch (choose){ case 1: display1(); break; case 2: display2(); break; case 3: settings(); break; case 4: closemusic(); closegraph(); exit(1); default:; } _getch(); }
void exitcode() { closegraph(); if ( StartupTextInfo.screenheight > 25 ) { textmode ( C4350 ); } else { textmode ( StartupTextInfo.currmode ); } printf ( "%s\n", ExitMessage ); }
void checkerrors() { int code; code = graphresult(); if (code!=grOk) { outtextxy(10, 460, grapherrormsg(code)); getch(); cleardevice(); closegraph(); exit (fprintf(stderr, "error = %s\n", grapherrormsg(code))!=0); } }
int main() { int gd=DETECT,gm; initgraph(&gd,&gm); void line_dda(int,int,int,int); int xa,xb,ya,yb; printf("Enter two coordinates\n"); scanf("%d %d",&xa,&ya); scanf("%d %d",&xb,&yb); line_dda(xa,ya,xb,yb); getch(); closegraph(); return 0; }
void main() { int driver=DETECT,mode; registerbgidriver(EGAVGA_driver); initgraph(&driver,&mode,""); DRAWPICTURE(); getch(); CLR_X(); setcolor(YELLOW); outtextxy(250,200,"Press any key to EXIT!"); getch(); closegraph(); }
main() { clrscr(); randomize (); clrscr(); printf("Please wait"); make_land(); clrscr(); disp_land(); getch(); closegraph(); }
void main() { struct tree *root=NULL,*temp,*dltree; int i,j,k,ch,n; int gd=0,gm; clrscr(); printf("\n1 insert"); printf("\n2 disp"); printf("\n3 delete"); while(1) { printf("\n enter choice:"); scanf("%d",&ch); switch(ch) { case 1: printf("\nEnter the data:"); scanf("%d",&n); if(root==NULL) { root=malloc(size); root->data=n; root->left=root->right=NULL; } else insert(root,n); break; case 2: initgraph(&gd,&gm,"e:\\tc\\bgi"); display(root,1,640,15,1); getch(); closegraph(); break; case 3: delet(root); if(dlt->left==NULL&&dlt->right==NULL) simple(root,dlt); if(dltree->left!=NULL&&dltree->right!=NULL) // complex(&dltree); // else // inter(&dltree); break; case 4: break; case 0: exit(0); } } }
int main() { int gd=DETECT,gm,color,fill_color,boundary_color; int xco,yco; DWORD dwWidth = GetSystemMetrics(SM_CXSCREEN); DWORD dwHeight = GetSystemMetrics(SM_CYSCREEN); initwindow(dwWidth,dwHeight); int x0=dwWidth/2; int y0=dwHeight/2; int i,j,x[50],y[50]; printf("%d\t%d\n\n",x0,y0); for(i=0; i<dwHeight; i++) putpixel(x0,i,YELLOW); for(j=0; j<dwWidth; j++) putpixel(j,y0,YELLOW); int n; int h; boundary_color=15; printf("Enter the number of sides or edges\n"); scanf("%d",&n); for(i=0; i<n; i++) { printf("Enter the %dth coordinate\n",i+1); scanf("%d",&x[i]); scanf("%d",&y[i]); } x[n]=x[0]; y[n]=y[0]; for(i=0; i<n; i++) printf("%d\t%d\n",x[i],y[i]); while(z!=(n)) { polylines(x[z],y[z],x[z+1],y[z+1],x0,y0); z++; } getch(); cleardevice(); closegraph(); }
void main() { int gd=DETECT,gm; int x1,x2,y1,y2,length,i; float dx,dy,x[100],y[100]; cout<<"\n Enter x1 and y1:"; cin>>x1>>y1; cout<<"\n Enter x2 and y2:"; cin>>x2>>y2; dx=fabs(x2-x1); dy=fabs(y2-y1); if(dx>=dy) { length=dx; } else { length=dy; } dx=(float)(x2-x1)/length; dy=(float)(y2-y1)/length; x[0]=x1+0.5*sign(dx); y[0]=y1+0.5*sign(dy); i=1; while(i<=length) { // cout<<i<<(x[i-1])<<(y[i-1]); x[i]=x[i-1]+dx; y[i]=y[i-1]+dy; i++; } getch(); initgraph(&gd,&gm,"C:\\TC\\BGI"); for(i=0;i<=length;i++) { putpixel(x[i],y[i],11); } getch(); closegraph(); }
int main() { int unidad = DETECT, modo,i,Vert,Horiz,Boton; MOUSE mouse; void uno(MOUSE &),dos(MOUSE &); void tres(MOUSE &),cuatro(MOUSE &),cinco(MOUSE &); void EscribirMenu(MOUSE &); mouse.Inicializar(); initgraph (&unidad,&modo,"c:\\bc\\bgi"); if (graphresult() != 0) { cout << "Error al tratar de pasar al modo grafico\n"; getch(); return 1; } mouse.Mostrar(); EscribirMenu(mouse); Boton = 0; while (Boton != DERECHO) { Boton = mouse.Estado(&Vert, &Horiz); if (Boton == IZQUIERDO) { if (Horiz >= 50 && Horiz <= 59) { uno(mouse); EscribirMenu(mouse); } else if (Horiz >= 60 && Horiz <= 69) { dos(mouse); EscribirMenu(mouse); } else if (Horiz >= 70 && Horiz <= 79) { tres(mouse); EscribirMenu(mouse); } else if (Horiz >= 80 && Horiz <= 89) { cuatro(mouse); EscribirMenu(mouse); } else if (Horiz >= 90 && Horiz <= 99) { cinco(mouse); EscribirMenu(mouse); } mouse.LibBotones(); } } closegraph(); return 0; }
int main() { /* request autodetection */ int gdriver = DETECT, gmode; /* initialize graphics mode */ initgraph(&gdriver, &gmode, ""); drawAxis(WHITE); Point o = {0,0}; Circle c = {o,130}; c.bressenPlot(RED); Point p[NUM_VERTICES]= { Point{129,10}, Point{28,10}, Point{-28,10}, Point{-129,10}, Point{129,-10}, Point{28,-10}, Point{-28,-10}, Point{-129,-10}, Point{10,129}, Point{10,28}, Point{10,-129}, Point{10, -28}, Point{-10,129}, Point{-10,28}, Point{-10,-129}, Point{-10, -28} }; Circle inCircle = {o, 30}; inCircle.bressenPlot(RED); seedFill4(o, RED, RED); double theta = -(3.142857*10)/180.0; do { for(int i = 0; i<16; i+=2) { Line l = Line {p[i], p[i+1]}; l.plotLineDDA(YELLOW); } delay(15); for(int i = 0; i<16; i+=2) { Line l = Line {p[i], p[i+1]}; l.plotLineDDA(BLACK); } rotateAll(p, theta); c.bressenPlot(RED); } while(1); getch(); closegraph(); return 0; }
void main() { int gd=0, gm=VGAHI; int i; struct ball b[10]; initgraph(&gd, &gm,"c:\\tc\\bgi\\"); for(i=1;i<=15;i++){ b[i].radius = rand()%20; b[i].x=rand()%getmaxx(); b[i].y=rand()%getmaxy(); b[i].dx=2; b[i].dy=4; } while(!kbhit()) { delay(5); cleardevice(); for(i=1;i<=15;i++) drawBall(&b[i],i); } closegraph(); }
void main() { int gdriver = DETECT, gmode; int x,j,y,x1,y1,x2,y2,i,dx,dy,p; clrscr(); detectgraph(&gdriver, &gmode); initgraph(&gdriver, &gmode, "C:\\TC\\BGI"); cout<<"starting points"; cin>>x1>>y1; cout<<"destination points"; cin>>x2>>y2; x=x1; y=y1; dx=x1-x; dy=y1-y; p=2*dy-dx; putpixel(x,y,WHITE); while(x<=x2) { x++; if(p<0) { p=p+2*dy; } else { y++; p=p+2*(dy-dx); } putpixel(x,y,BLUE); } for(i=0;i<=100;i++) { for(j=0;j<=10;j++) { putpixel(x-2*i,y-2*i,j); } } getch(); closegraph(); getch();}
//PERSONAL void display() { int gd = DETECT, gm=0; initgraph(&gd,&gm,"C:\\turboc3\\BGI"); clrscr(); line(125,25,125,450); line(525,25,125,25); line(525,450,525,25); line(525,63,125,63); line(125,450,525,450); line(300,25,300,450); line(525,101,125,101); line(525,139,125,139); line(525,177,125,177); line(525,223,125,223); line(525,261,125,261); line(525,299,125,299); line(525,337,125,337); line(525,337,125,337); line(525,375,125,375); line(525,413,125,413); line(525,451,125,451); gotoxy(25,3); printf("NAME"); gotoxy(21,6); printf("FATHER'S NAME"); gotoxy(21,8); printf("MOTHER'S NAME"); gotoxy(20,10); printf("DATE OF BIRTH"); gotoxy(24,13); printf("ADDRESS"); gotoxy(21,16); printf("MOBILE NUMBER"); gotoxy(21,18); printf("STUDENT'S EMAIL"); gotoxy(21,20); printf("PARENT'S EMAIL"); gotoxy(21,23); printf("ENROLLMENT NO."); gotoxy(21,25); printf("COURSE"); gotoxy(21,26); printf("\n\n\n\t\t SEMESTER"); getch(); closegraph(); }