void main() { title(); int k=1,a=9; clrscr(); cout<<"How many players do you want (2-4) :"; cin>>n; if (n<2||n>4) { cout<<"Error"; getch(); exit(0); } while(a>=0) { for(int i=0;i<10;i++) mat[a][i]=k++; a--; for(i=9;i>=0;i--) mat[a][i]=k++; a--; } for(k=0;k<n;k++) { cout<<"Player "<<k+1<<" Enter initial :"; cin>>pini[k][0]; pini[k][1]='\0'; } clrscr(); a=DETECT; initgraph(&a,&k,"C:\\TC\\BGI"); while (victory==0) for(int i=0;i<n;i++) { cleardevice(); grid(); for(int j=0;j<n;j++) for(int y=0;y<10;y++) for(int x=0;x<10;x++) if (mat[y][x]==player[j]) showcounter(x,y,j); char g[20]; settextjustify(0,1); settextstyle(2,0,5); sprintf(g,"Player %d:Your chance",i+1); setcolor(BLACK); outtextxy(480,20,g); randomize(); int dice=rand()%6+1; while(!kbhit()) for(int z=1;z<7;z++) { diceshow(z); delay(50); } getch(); diceshow(dice); getch(); if (player[i]+dice>100) continue; player[i]+=dice; for(k=1;k<n;k++) for(j=0;j<n;j++) if (player[i]==player[j]&&i!=j) player[i]++; for(j=0;j<17;j++) { if(player[i]==snl[j][0]) player[i]=snl[j][1]; } for(k=1;k<n;k++) for(j=0;j<n;j++) if (player[i]==player[j]&&i!=j) player[i]++; for(j=0;j<17;j++) { if(player[i]==snl[j][0]) player[i]=snl[j][1]; } if(player[i]==100) { victory=i+1; break; } } cleardevice(); setcolor(RED); rectangle(24,24,616,456); setfillpattern(0,RED); floodfill(0,0,RED); settextjustify(1,1); char g[40]; sprintf(g,"Winner is Player %d.CONGRATULATIONS.",victory); settextstyle(3,0,3); outtextxy(310,239,g); getch(); }
void rect(int i) { setbkcolor(0); if(300+i<=0) keyhit(i+=10); else if(350+i>=640) keyhit(i-=10); else {setlinestyle(DASHED_LINE,1,2); rectangle(300+i,429,350+i,436); setlinestyle(SOLID_LINE,1,2); rectangle(310+i,419,340+i,429); rectangle(322+i,409,328+i,419); setcolor(GREEN); line(10,438,630,438); setfillstyle(SOLID_FILL,6); bar(10,440,630,445);floodfill(12,441,6); setcolor(1); settextstyle(11,0,4); outtextxy(80,460,"Designed and Developed by <<::>> Tejendra Singh & Shubham Singh"); setcolor(RED); settextstyle(11,0,4); outtextxy(15,20,"Score:"); setcolor(WHITE); circle(303+i,432,3); circle(312+i,432,3); circle(324+i,432,3); circle(336+i,432,3); circle(347+i,432,3); setcolor(i+1); outtextxy(10,50,"."); setcolor(i+1); outtextxy(20,100,"."); setcolor(i+2); outtextxy(30,150,"."); setcolor(i+3); outtextxy(50,50,"."); setcolor(i+4); outtextxy(90,200,"."); setcolor(i+5); outtextxy(420,277,"."); setcolor(i+6); outtextxy(150,110,"."); setcolor(i+7); outtextxy(350,300,"."); setcolor(i+8); outtextxy(200,140,"."); setcolor(i+9); outtextxy(550,280,"."); setcolor(i+10); outtextxy(300,250,"."); setcolor(i+11); outtextxy(560,260,"."); setcolor(i+12); outtextxy(400,70,"."); setcolor(i+13); outtextxy(15,239,"."); setcolor(i+14); outtextxy(450,166,"."); setcolor(i+15); outtextxy(300,59,"."); setcolor(i+16); outtextxy(500,80,"."); setcolor(i+17); outtextxy(290,95,"."); setcolor(i+18); outtextxy(530,89,"."); setcolor(i+19); outtextxy(150,305,"."); setcolor(RED); } }
void main() { if(InitGraphics() == -1) return; initialisedata(); clearviewport(); rectangle(0,0,(maxx+1)*width+2, (maxy+1)*width+2); sx = (maxx+1)*width+6; sy = (maxy+1)*width+2; int loop = 0; while(!endgame) { loop++; for (int i = 0; i < NUM_PLAYERS; i++) { drawplayer(plist[i]); } showscoreboard(); delay(DELAY_INTERVAL); for (i = 0; i < NUM_PLAYERS; i++) { showbox(plist[i]); } if (kbhit()) { handlekeypress(); } if (endgame) break; // 1 to n is computer plaer, 0 is me for (i = 1; i < NUM_PLAYERS; i++) { decidemove(plist[i]); } for (i = 0; i < NUM_PLAYERS; i++) { adjustdir(plist[i]); moveit(plist[i]); } for (i = 0; i < NUM_PLAYERS; i++) { updatescore(plist[i]); if (plist[i].score >= WINNING_SCORE) { endgame = true; setfillstyle(1, BLUE); bar(200,120,439,300); outtextxy(250,200,"GAME OVER"); if (i == 0) { outtextxy(250,250,"YOU WIN"); } else { outtextxy(250,250,"YOU LOSE"); } showscoreboard(); char tr = getch(); } } } }
void map() { initgraph(900,600); setbkcolor(BLACK); cleardevice(); setcolor(YELLOW); setfont(70,0,"华文行楷"); outtextxy(730,10,"说明"); setcolor(GREEN); setfont(25,0,"楷体"); outtextxy(715,80,"向上按 W或↑"); outtextxy(715,105,"向下按 S或↓"); outtextxy(715,130,"向左按 A或←"); outtextxy(715,155,"向右按 D或→"); outtextxy(715,180,"暂停按 空格键 "); setcolor(LIGHTCYAN); setfont(50,0,"华文隶书"); outtextxy(710,220,"得分:"); setcolor(LIGHTCYAN); setfont(50,0,"华文行楷"); outtextxy(835,220,"0"); setcolor(LIGHTGREEN); setfont(50,0,"华文行楷"); outtextxy(710,280,"关次:"); setcolor(BROWN); setfont(50,0,"华文行楷"); if(cp==1) outtextxy(840,280,"1"); if(cp==2) outtextxy(840,280,"2"); if(cp==3) outtextxy(840,280,"3"); setcolor(RED); setfont(40,0,"华文行楷"); outtextxy(705,350,"游戏制作人"); setcolor(RED); setfont(40,0,"华文行楷"); outtextxy(725,400,"软工1406"); setcolor(LIGHTGREEN); setfont(60,0,"华文行楷"); outtextxy(710,470,"李鑫焱"); int i,m,n; for(i=1,m=0,n=0;i<=35;i++) { setfillcolor(BROWN); setcolor(RED); bar(m,n,m+20,n+20); m+=20; } for(i=1,m=0,n=580;i<=35;i++) { setfillcolor(BROWN); setcolor(RED); bar(m,n,m+20,n+20); m+=20; } for(i=1,m=0,n=0;i<=30;i++) { setfillcolor(BROWN); setcolor(RED); bar(m,n,m+20,n+20); n+=20; } for(i=1,m=680,n=0;i<=40;i++) { setfillcolor(BROWN); setcolor(RED); bar(m,n,m+20,n+20); n+=20; } if(cp==2) { setcolor(BROWN); setfillcolor(BROWN); bar(200,160,200+20,160+240); bar(420,280,420+20,280+160); } if(cp==3) { setcolor(BROWN); setfillcolor(BROWN); bar(200,160,200+20,160+240); bar(420,280,420+20,280+160); bar(300,200,300+300,200+20); } }
void game_variables::over() { outtextxy(centrex-20, centrey, "GAME OVER!!"); getch(); getch(); menu.options(); }
void myDraw(void) { setcolor(1.0F,1.0F,1.0F); switch (bascule) { /* Trace un rectangle rouge a l'ecran si active * par appui de la touche 'a' */ /*setcolor(1.0F,0.0F,0.0F); bar(-0.5F,-0.5F,0.5F,0.5F);*/ case'a': zoom*=1.1; break; case'r': zoom*=0.9; break; case't': //Tracer(tab[0]); break; case'z': DecalageY -= graduation*x*0.1; break; case'q': DecalageX += graduation*x*0.1; break; case's': DecalageY += graduation*x*0.1; break; case'd': DecalageX -= graduation*x*0.1; break; } if(bascule != 'e') { Tracer(tab[0]); } setcolor(1.0F,1.0F,0.0F); outtextxy(-1.0,0.94,"a : Agrandir"); outtextxy(-0.8,0.94,"/ r : Retrecir"); outtextxy(-0.15,0.94,"t : Tracer"); outtextxy(0.03,0.94,"/ e : Effacer"); outtextxy(0.5,0.94,"z : Haut"); outtextxy(-1.0,0.84,"s : Bas"); outtextxy(-0.15,0.84,"q : Gauche"); outtextxy(0.5,0.84,"d : Droite"); char g[10]; sprintf(g,"%.2f",graduation); char aff[23] = "graduation : "; strcat(aff, g); outtextxy(0.6,-0.9, aff); /*Tracage des axes*/ setcolor(1.0F,1.0F,1.0F); // met en couleur la courbe double abs = fabs(Ymin)/(Ymax-Ymin); abs= -x+abs*x*2; line((-1*x)*zoom + DecalageX,(abs)*zoom + DecalageY,(1*x)*zoom + DecalageX,(abs)*zoom + DecalageY);//abscisse double ordo = fabs(Xmin)/(Xmax-Xmin); ordo = -x+ordo*x*2; line((ordo)*zoom + DecalageX,(-1*x)*zoom + DecalageY,(ordo)*zoom + DecalageX,(1*x)*zoom + DecalageY);//ordonné double test1 = (Xmax-Xmin)/graduation; double pasX = x*2/test1; double test2 = (Ymax-Ymin)/graduation; double pasY = x*2/test2; for(float i=0;i<=(x*2);i+=pasX) { line((-x+i)*zoom + DecalageX,(-0.01+abs)*zoom + DecalageY,(-x+i)*zoom + DecalageX,(0.01+abs)*zoom + DecalageY);//grad abscisse } for(float i=0;i<=(x*2);i+=pasY) { line((-0.01+ordo)*zoom + DecalageX,(-x+i)*zoom + DecalageY,(0.01+ordo)*zoom + DecalageX,(-x+i)*zoom + DecalageY);// grad ordonnées } outtextxy(ordo-0.05 + DecalageX,abs-0.05+DecalageY,"0"); }
void main() { int driver=0,mode=VESA_1024x768x8bit,paused=0; char *p; block bl; int key,n=1; long t0; initgraph(&driver,&mode,""); randomize(); memset(map_check,0,sizeof(map_check)); draw_map(); t0=time(NULL); init_block(&bl); itoa(score,ss,10); outtextxy(X0+470,Y0+320,ss); outtextxy(X0+397,Y0+220,"Press spacebar to pause"); outtextxy(X0+397,Y0+270,"Press spacebar agian to continue"); while(!stop) { show_block(bl); if(check_xy(bl)==3) { bl.y--; init_block(&bl); check_gameover(); show_block(bl); } while(((long)time(NULL)-t0)<=n*dtime) { if(bioskey(1)!=0) { key=bioskey(0); clear_block(bl); switch(key) { case UP:bl.rotate++;break; case LEFT:bl.x--;break; case RIGHT:bl.x++;break; case DOWN:bl.y++;break; case ESC:stop=1;break; case SPACE:show_block(bl);paused=1;break; default:break; } while(paused){ if(bioskey(1)!=0) { if(bioskey(0)==SPACE) { clear_block(bl); paused=0; break; } } } if(bl.rotate>3 || bl.rotate<0) bl.rotate=0; if(check_xy(bl)==1) bl.x++; if(check_xy(bl)==2) bl.x--; if(check_xy(bl)==3) { bl.y--; check_gameover(); show_block(bl); while(cover()) { delete_last(cover()); score+=100; setfillstyle(SOLID_FILL,BLACK); bar(X0+460,Y0+300,X0+520,Y0+340); itoa(score,ss,10); setcolor(WHITE); outtextxy(X0+470,Y0+320,ss); } init_block(&bl); check_gameover(); } if(check_collision(bl)) { if(key==UP) bl.rotate--; if(key==LEFT) bl.x++; if(key==RIGHT) bl.x--; if(key==DOWN) { bl.y--; check_gameover(); show_block(bl); while(cover()) { delete_last(cover()); score+=100; setfillstyle(SOLID_FILL,BLACK); bar(X0+460,Y0+300,X0+520,Y0+340); itoa(score,ss,10); setcolor(WHITE); outtextxy(X0+470,Y0+320,ss); } init_block(&bl); check_gameover(); } } check_gameover(); show_block(bl); } } clear_block(bl); bl.y++; if(check_xy(bl)==3 || check_collision(bl)) { bl.y--; check_gameover(); show_block(bl); while(cover()) { delete_last(cover()); score+=100; setfillstyle(SOLID_FILL,BLACK); bar(X0+460,Y0+300,X0+520,Y0+340); itoa(score,ss,10); setcolor(WHITE); outtextxy(X0+470,Y0+320,ss); } init_block(&bl); check_gameover(); } n++; } getchar(); closegraph(); }
void node::changename() { int i=0; // setviewport(200,200,400,250,0); setfillstyle(SOLID_FILL,9); // bar(200,200,400,252); //////////// unsigned size; void far*q; size=imagesize(200,200,400,252); q=(void far*)malloc(size); getimage(200,200,400,252,q); ////////////// // putimage(20,20,q,0); bar(200,200,400,252); char *a="change",*b="next",*c="close"; rectangle(200,230,260,250);//change button outtextxy(205,233,a); rectangle(267,230,330,250);//next button outtextxy(274,233,b); rectangle(334,230,400,250);//close button outtextxy(338,233,c); // textbackground(9); // textcolor(6); int k=1; while(flag==1&&i<=nodenum) { //gotoxy(28,14); // textbackground(3); //textcolor(12); //cprintf("dsfr"); // if(k==1) // { outtextxy(210,210,"to change;click change"); k++; // } getmousepos(); if(button==1&&x<260&&x>200&&y<250&&y>230) //change { /*gotoxy(33,14); char cc; int j=0; while((cc=getchar())!='\n') {n[i].name[j]=cc;j++;}*/ bar(200,200,400,229); char h[2]; *h=i+48; *(h+1)=':'; *(h+2)='\0'; outtextxy(210,210,h); char cc; int j=0; while((cc=getchar())!='\n') { n[i].name[j]=cc; j++; } } if(button==1&&x<330&&x>267&&y<250&&y>230) //next { i++; /* gotoxy(28,14); cprintf(" %d :%s ",n[i].id,n[i].name); continue;*/ } if(button==1&&x<400&&x>334&&y<250&&y>230) //close { hidemouseptr(); putimage(200,200,q,0); showmouseptr(); break; } } }
int main() { int gd=DETECT,gm; initgraph(&gd,&gm,""); int c=12; setbkcolor(0); //setlinestyle(0,1,2); int t; while(1) { settextstyle(2,0,5); outtextxy(100,10,"Press L,H ,T,P"); outtextxy(100,30,"Press 1 for Quit"); as: setcolor(13); ellipse(380,127,20,152,130,35); //////////////////////////////rear////////////////////////// line(490,109,560,142); line(560,142,569,142); line(569,142,582,102); line(582,102,620,92); line(593,132,617,125); line(617,124,627,96); line(620,92,628,97); line(472,86,602,96); line(501,113,575,121); line(443,77,475,80); line(443,77,432,93); line(475,80,472,85); //setcolor(4); line(593,132,593,137); line(593,137,600,141); line(600,141,600,185); line(600,185,608,192); line(608,192,608,234); line(608,234,586,253); line(586,253,577,248); ///////////////////////// mirror line(263,112,363,127); line(193,160,263,112); line(193,160,220,170); line(220,170,280,180); line(280,180,320,185); line(320,185,363,127); ////////////////////////////////sidemirror line(340,194,460,169); line(460,169,519,152); ellipse(512,144,300,30,10,10); ellipse(467,143,28,100,50,30); line(510,128,521,138); line(435,116,440,171); // setcolor(4); ////////////////////////////////////////cont// line(339,194,372,144); // line(372,140,386,128); ellipse(454,208,87,123,128,95); line(372,144,384,128); int b,x,y; ////////////////////////lower line(365,298,524,264); line(365,298,330,310); line(330,310,323,310); ///////////////////////////////bumper ellipse(162,221,135,190,90,40); line(96,193,140,174); line(140,174,160,168); line(160,168,192,161); //////////////////////front ellipse(75,246,95,190,18,18); line(57,251,57,286); //setcolor(4); ellipse(181,178,232,263,200,137); ellipse(195,180,256,286,200,137); ellipse(191,171,228,247,200,100); ellipse(231,198,234,275,200,80); //setcolor(9); //ellipse(195,170,256,286,200,137); //setcolor(12); ellipse(196,167,228,246,200,90); ellipse(231,184,234,276,200,80); ellipse(191,200,228,246,200,90); ellipse(228,218,234,276,200,80); ellipse(258,268,180,220,200,40); ellipse(178,296,244,355,16,10); ellipse(238,249,227,250,200,60); /////////////wheel1 ellipse(302,281,320,77,26,45); ellipse(290,277,65,162,40,45); ellipse(278,288,144,212,31,45); /////////////wheel2 //setcolor(5); ellipse(302+260,229,328,87,26,45); ellipse(290+280-7,277-50+2,90,162,40,45); ellipse(278+270,288-50,144,215,27,45); b=0; int v=0; ///////// ellipse(302+250+v,227+b,295,90,29,41); ellipse(302+234+v,231+b,245,306,50,40); //setlinestyle(3,0,3); ellipse(302+248+v,229+b,0,360,21,30); ellipse(302+247+v,229+b,0,360,8,10); setfillstyle(6,11); floodfill(302+248+v,230+b,13); line(546,201,546,257); line(554,201,554,257); setcolor(4); line(546+v,201+b,546+v,220+b); line(551+v,201+b-2,551+v,220+b); line(546+v,238+b,546+v,257+b); line(551+v,238+b+2,551+v,257+b+2); line(530+v,225+b,541+v,225+b); line(530+v,230+b,541+v,230); line(557+v,225+b,570+v,225+b); line(557+v,230+b,570+v,230+b); line(563+v,206+b,552+v,222+b); line(534+v,246+b,543+v,232+b); line(566+v,210+b,556+v,223+b); line(536+v,250+b,544+v,238+b); line(536+v,207+b,546+v,222+b); line(532+v,213+b,542+v,224+b); line(556+v,235+b,566+v,247+b); line(551+v,237+b,563+v,253+b); //////////////////////////////////////////////////// v=-260; b=56; ellipse(302+233+v,221+b,260,60,49,51); ellipse(302+234+v,231+b,245,306,50,40); setlinestyle(3,0,3); ellipse(302+243+v,224+b,0,360,28,35); line(249,328,269,328); ellipse(300+245+v,223+b,0,360,10,12); ellipse(285+249+v,239+b,210,260,30,33); floodfill(285+258+v,230+b,12); b=45; v=v-4; line(546+v,201+b,546+v,220+b+2); line(551+v,201+b,551+v,220+b+2); b=b+8; line(546+v,238+b,546+v,257+b+4); line(551+v,238+b,551+v,257+b+4); v=v-2; line(530+v-6,225+b,541+v,225+b); line(530+v-6,230+b,541+v,230+b); v=v+5; line(557+v,225+b,570+v+3,225+b); line(557+v-1,230+b,570+v+3,230+b); b=b-5; v=v-5; line(565+v+3,206+b,552+v+4,222+b-2); b=b+15; line(534+v,246+b,543+v+3,232+b-5); b=b-10; line(566+v+7,210+b-5,556+v+4,220+b); line(536+v-5,250+b,544+v-2,238+b-4); line(536+v,207+b-8,545+v,222+b-5); line(531+v,212+b-8,542+v,224+b-2); line(556+v,235+b,566+v+3,247+b+5); line(551+v,237+b,563+v+2,253+b+3); ///////////////////lights ellipse(199,250,144,345,18,8); line(185,245,206,230); setcolor(4); ellipse(223,234,340,110,8,5); line(230,237,217,252); line(206,230,220,229); setfillstyle(1,4); floodfill(200,240,12); ///////////////////////////////////// line(90,223,152,236); line(152,236,137,254); line(90,223,90,242); setfillstyle(10,9); floodfill(91,230,14); ellipse(240,270,104,136,100,60); ellipse(185,237,120,160,100,60); ellipse(80,221,357,134,10,10); line(152,236,168,228); /////////////////////////////////////////////// line(435,116,440,171); //////////////////////////////////////////hp line(134,185,220,210); line(134,185,196,160); line(214,212,318,185); /////////////////////////////////////////////////light setcolor(14); ellipse(166,247,99,330,8,8); ellipse(171,243,310,129,7,7); putpixel(174,250,13); putpixel(173,251,13); putpixel(164,239,13); putpixel(165,238,13); /////////////////////////////////////////road///////////////////// setcolor(13); line(1,430,639,300); line(1,445,639,315); line(1,210,93,194); line(1,195,194,158); line(1,170,639,71); line(1,170,229,135); line(520,90,639,71); line(478,86,639,56); int c=0; line(10,194+c,10,208+c); line(40,189+c,40,204+c); line(70,183+c,70,198+c); line(100,176+c,100,190+c); line(130,170+c,130,177+c); line(160,166+c,160,168+c); line(190,160+c,190,161+c); line(190+330,78+c,190+330,89+c); line(190+360,72+c,190+360,85+c); line(190+390,67+c,190+390,81+c); line(190+420,62+c,190+420,76+c); line(190+449,57+c,190+449,71+c); c=236; line(10,192+c,10,208+c); line(40,189+c-2,40,204+c-3); line(70,183+c-3,70,198+c-3); line(100,176+c-2,100,190+c-2); line(130,170+c-2,130,177+c+5); line(160,166+c-3,160,168+c+8); line(190,160+c-4,190,161+c+9); line(190+30,156+c-5,190+30,170+c-5); line(190+30+30,156+c-12,190+30+30,170+c-12); line(190+90,156+c-18,190+90,170+c-17); line(190+120,156+c-25,190+120,170+c-25); line(190+150,156+c-30,190+150,170+c-30); line(190+180,156+c-37,190+180,170+c-36); line(190+210,156+c-42,190+210,170+c-42); line(190+240,156+c-48,190+240,170+c-48); line(190+270,156+c-55,190+270,170+c-54); line(190+300,156+c-61,190+300,170+c-61); line(190+330,78+c+10,190+330,89+c+13); line(190+360,72+c+11,190+360,85+c+13); line(190+390,67+c+10,190+390,81+c+10); line(190+420,62+c+8,190+420,76+c+10); line(190+449,57+c+8,190+449,71+c+8); /////////////////road setcolor(12); /////////////////////////////1 line(1,310,25,306); line(6,318,30,315); line(1,310,6,318); line(25,306,30,314); int k,m; k=13*45+19; m=16*(-8); //2 setcolor(12); line(605,310-128,629,306-128); line(610,318-128,634,315-128); line(605,310-128,610,318-128); line(629,306-128,634,314-128); setcolor(12); //////////////////////////////////3 k=45; m=-8; line(46,302,70,298); line(51,310,75,307); line(46,302,51,310); line(70,298,75,306); setfillstyle(1,0); floodfill(64,303,12); setfillstyle(1,14); floodfill(14,314,12); floodfill(617,183,12); setfillstyle(1,0); floodfill(14,314,12); floodfill(617,183,12); setfillstyle(1,14); floodfill(64,303,12); t=getch(); if(t=='1') exit(0); if(t=='h') { //sound(710); delay(50); //nosound(); break; } if(t=='t') { while(!kbhit()) { setfillstyle(1,0); floodfill(536,213,13); floodfill(563,213,13); floodfill(561,244,13); floodfill(538,244,13); floodfill(274,295,13); floodfill(294,295,13); floodfill(274,265,13); floodfill(294,265,13); floodfill(548,250,13); floodfill(548,214,13); floodfill(533,228,13); floodfill(563,228,13); floodfill(262,281,13); floodfill(308,281,13); floodfill(284,251,13); floodfill(284,295,13); setfillstyle(1,12); floodfill(200,250,13); delay(10); setfillstyle(1,11); floodfill(170,250,13); floodfill(80,230,13); } setfillstyle(1,0); floodfill(200,250,13); delay(10); setfillstyle(1,11); floodfill(170,250,13); floodfill(80,230,13); } if(t=='l') { while(!kbhit()) { delay(120); setfillstyle(6,0); //////////////////////////ty floodfill(536,213,13); floodfill(563,213,13); floodfill(561,244,13); floodfill(538,244,13); floodfill(274,295,13); floodfill(294,295,13); floodfill(274,265,13); floodfill(294,265,13); setfillstyle(1,0); floodfill(64,303,12); ///////////////////////////////////road setfillstyle(9,0); /////////////////////color floodfill(81-40+5,419+7,13); floodfill(151-40,409+7,13); floodfill(211-40,397+7,13); floodfill(271-40,380+7,13); floodfill(331-40,368+7,13); floodfill(396-40,355+7,13); floodfill(450-40,345+7,13); floodfill(510-40,335+7,13); floodfill(570-40,325+7,13); floodfill(630-40,312+7,13); ////////////////////// floodfill(50,197,13); floodfill(110,177,13); floodfill(166,165,13); floodfill(527,86,13); floodfill(587,71,13); setfillstyle(6,14); //////////////////////////ty floodfill(548,250,13); floodfill(548,214,13); floodfill(533,228,13); floodfill(563,228,13); floodfill(262,281,13); floodfill(308,281,13); floodfill(284,251,13); floodfill(284,295,13); ////////////////////////////////////////road setfillstyle(9,10);///////////////////////////////////color floodfill(19,429,13); floodfill(81,419,13); floodfill(151,409,13); floodfill(211,397,13); floodfill(271,380,13); floodfill(331,368,13); floodfill(396,355,13); floodfill(450,345,13); floodfill(510,335,13); floodfill(570,325,13); floodfill(630,312,13); ////////////////////////////////////// floodfill(20,197,13); floodfill(80,187,13); floodfill(133,174,13); floodfill(517,86,13); floodfill(557,81,13); floodfill(627,70,13); setfillstyle(1,14); floodfill(14,314,12); floodfill(617,183,12); /////////////////////////////////////// setfillstyle(10,4); floodfill(302+248,230,13); floodfill(302+248+v,230+b,13); ///light setfillstyle(6,11); /////////// floodfill(200,250,13); floodfill(170,250,13); floodfill(80,230,13); delay(120); setfillstyle(6,0);/////////////////////ty floodfill(548,250,13); floodfill(548,214,13); floodfill(533,228,13); floodfill(563,228,13); floodfill(262,281,13); floodfill(308,281,13); floodfill(284,251,13); floodfill(284,295,13); /////////////////////////////////////road setfillstyle(9,0); ///////////////color floodfill(19,429,13); floodfill(81,419,13); floodfill(151,409,13); floodfill(211,397,13); floodfill(271,380,13); floodfill(331,368,13); floodfill(396,355,13); floodfill(450,345,13); floodfill(510,335,13); floodfill(570,325,13); floodfill(630,312,13); /////////////////////////////////////////////////////// floodfill(20,197,13); floodfill(80,187,13); floodfill(133,174,13); floodfill(517,86,13); floodfill(557,81,13); floodfill(627,70,13); ///////////////////////////// setfillstyle(1,0); floodfill(14,314,12); floodfill(617,183,12); setfillstyle(6,10); /////////////ty floodfill(536,213,13); floodfill(563,213,13); floodfill(561,244,13); floodfill(538,244,13); floodfill(274,295,13); floodfill(294,295,13); floodfill(274,265,13); floodfill(294,265,13); ////////////////////////////////////////////////road setfillstyle(9,14);/////////////////////////////////////////color floodfill(81-40+5,419+7,13); floodfill(151-40,409+7,13); floodfill(211-40,397+7,13); floodfill(271-40,380+7,13); floodfill(331-40,368+7,13); floodfill(396-40,355+7,13); floodfill(450-40,345+7,13); floodfill(510-40,335+7,13); floodfill(570-40,325+7,13); floodfill(630-40,312+7,13); ///////////////////////////////////////// floodfill(50,197,13); floodfill(110,177,13); floodfill(166,165,13); floodfill(527,86,13); floodfill(587,71,13); setfillstyle(1,14); floodfill(64,303,12); setfillstyle(9,4); floodfill(302+248,230,13); floodfill(302+248+v,230+b,13); delay(20); setfillstyle(1,14); floodfill(200,250,13); floodfill(170,250,13); floodfill(80,230,13); delay(20); setfillstyle(1,0); floodfill(200,250,13); floodfill(170,250,13); floodfill(80,230,13); } } if(t=='p') { int n=0; while(!kbhit()) { if(n<=60) n++; setcolor(0); rectangle(1+1,-10,90-1,-12+n); delay(14); setcolor(9); rectangle(1,-10,90,-10+n); if(n==60) { outtextxy(10,10,"L-LIGHTS"); outtextxy(10,20,"H-HORN"); outtextxy(10,30,"T-AllOY"); delay(400); } } setcolor(0); rectangle(1,-10,90,-10+n); rectangle(1,-10,90,-11+n); outtextxy(10,10,"L-LIGHTS"); outtextxy(10,20,"H-HORN"); outtextxy(10,30,"T-AllOY"); } } circle(300,100,3); //nosound(); getch(); }
void graphicize() { clrscr(); int gd = DETECT, gm, errorcode; int rect[8]={0}; initgraph(&gd, &gm, "c://turboc3/tc/bgi"); errorcode = graphresult(); if (errorcode != grOk) { cout << ":: Graphics error ::"; cout << "\nCheck the BGI Directory Path for Graphics Files"; getch(); exit(1); } int gmx=getmaxx(); int gmy=getmaxy(); setviewport((gmx-600)/2, (gmy-200)/2, ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1); setbkcolor(3); setcolor(1); line(0,0,600,0);line(0,30,600,30);line(0,60,600,60); line(0,90,600,90);line(0,120,600,120);line(0,150,600,150); line(0,180,600,180); int r; int l; for(l=0;l<gsize;l++) { rect[0]=gtable[l][1]; rect[1]=(gtable[l][0]-1)*30; rect[2]=gtable[l][2]; rect[3]=(gtable[l][0]-1)*30; rect[4]=gtable[l][2]; rect[5]=gtable[l][0]*30; rect[6]=gtable[l][1]; rect[7]=gtable[l][0]*30; setfillstyle(SOLID_FILL,6); fillpoly(4,rect); } setviewport((gmx-600)/2+3, (gmy-200)/2-20, ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1); outtextxy(0,5,"01"); outtextxy(20,5,"02"); outtextxy(40,5,"03"); outtextxy(60,5,"04"); outtextxy(80,5,"05"); outtextxy(100,5,"06"); outtextxy(120,5,"07"); outtextxy(140,5,"08"); outtextxy(160,5,"09"); outtextxy(180,5,"10"); outtextxy(200,5,"11"); outtextxy(220,5,"12"); outtextxy(240,5,"13"); outtextxy(260,5,"14"); outtextxy(280,5,"15"); outtextxy(300,5,"16"); outtextxy(320,5,"17"); outtextxy(340,5,"18"); outtextxy(360,5,"19"); outtextxy(380,5,"20"); outtextxy(400,5,"21"); outtextxy(420,5,"22"); outtextxy(440,5,"23"); outtextxy(460,5,"24"); outtextxy(480,5,"25"); outtextxy(500,5,"26"); outtextxy(520,5,"27"); outtextxy(540,5,"28"); outtextxy(560,5,"29"); outtextxy(580,5,"30"); setviewport((gmx-600)/2, (gmy-200)/2-20, ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1); line(0,0,600,0); for(r=0;r<31;r++) { line(20*r,0,20*r,200); } setviewport((gmx-600)/2, 50 , ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1); setcolor(4); settextstyle(DEFAULT_FONT,HORIZ_DIR,3); outtext("GANNT CHART"); setviewport((gmx-600)/2, 80 , ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1); setcolor(8); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); outtext("No. of Processes : "); if(n==1) outtext("1"); if(n==2) outtext("2"); if(n==3) outtext("3"); if(n==4) outtext("4"); if(n==5) outtext("5"); if(n==6) outtext("6"); setviewport((gmx-600)/2, 100 , ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1); outtext("Scheduling Method : "); if(choice=='1') outtext("FCFS - First Come First Serve"); if(choice=='2') outtext("SJF - Shortest Job First"); if(choice=='3') outtext("SRTF - Shortest Remaining Time First"); if(choice=='4') outtext("RR - Round Robin"); setviewport((gmx-600)/2-10, (gmy-200)/2, ((gmx-600)/2)+600, ((gmy-200)/2)+200, 1); setcolor(1); outtextxy(0,25-15,"1"); outtextxy(0,55-15,"2"); outtextxy(0,85-15,"3"); outtextxy(0,115-15,"4"); outtextxy(0,145-15,"5"); outtextxy(0,175-15,"6"); getch(); closegraph(); }
main() { int driver = DETECT, mode; char c; int k1[] = { 0, 0, 20, 0, 20, 60, 30, 60, 30, 100, 0, 100, 0, 0 }; int k2[] = { 40, 0, 50, 0, 50, 60, 60, 60, 60, 100, 30, 100, 30, 60, 40, 60, 40, 0 }; int k3[] = { 70, 0, 90, 0, 90, 100, 60, 100, 60, 60, 70, 60, 70, 0 }; int k4[] = { 90, 0, 110, 0, 110, 60, 120, 60, 120, 100, 90, 100, 90, 0 }; int k5[] = { 130, 0, 140, 0, 140, 60, 150, 60, 150, 100, 120, 100, 120, 60, 130, 60, 130, 0 }; int k6[] = { 160, 0, 170, 0, 170, 60, 180, 60, 180, 100, 150, 100, 150, 60, 160, 60, 160, 0 }; int k7[] = { 190, 0, 210, 0, 210, 100, 180, 100, 180, 60, 190, 60, 190, 0 }; int k8[] = { 210, 0, 230, 0, 230, 60, 240, 60, 240, 100, 210, 100, 210, 0 }; int k9[] = { 250, 0, 260, 0, 260, 60, 270, 60, 270, 100, 240, 100, 240, 60, 250, 60, 250, 0 }; int k10[] = { 280, 0, 300, 0, 300, 100, 270, 100, 270, 60, 280, 60, 280, 0 }; int k11[] = { 300, 0, 330, 0, 330, 100, 300, 100, 300, 0 }; int k12[] = { 330, 0, 360, 0, 360, 100, 330, 100, 330, 0 }; initgraph(&driver, &mode, ""); int maxx = getmaxx(); int maxy = getmaxy(); for (long j = 0; j <= 300; j++) { putpixel(random(maxx), random(maxy), 4); delay(1); } setfillstyle(SOLID_FILL, BLACK); bar(89, 39, 571, 261); setlinestyle(SOLID_LINE, 3, 3); line(90, 50, 90, 250); //outline line(100, 40, 540, 40); line(100, 260, 540, 260); line(550, 250, 550, 50); arc(100, 50, 90, 180, 10); arc(100, 250, 180, 270, 10); arc(540, 250, 270, 360, 10); arc(540, 50, 0, 90, 10); circle(200, 90, 35); setfillstyle(SOLID_FILL, 9); floodfill(200, 90, WHITE); circle(482, 95, 42); setfillstyle(SOLID_FILL, 3); floodfill(482, 95, WHITE); setlinestyle(SOLID_LINE, 1, 1); rectangle(270, 60, 370, 130); setfillstyle(SOLID_FILL, 14); floodfill(290, 80, WHITE); rectangle(270, 130, 295, 140); setfillstyle(SOLID_FILL, 5); floodfill(280, 135, WHITE); rectangle(295, 130, 320, 140); setfillstyle(SOLID_FILL, 5); floodfill(300, 135, WHITE); rectangle(320, 130, 345, 140); setfillstyle(SOLID_FILL, 5); floodfill(330, 135, WHITE); rectangle(345, 130, 370, 140); setfillstyle(SOLID_FILL, 5); floodfill(350, 135, WHITE); rectangle(120, 60, 145, 70); setfillstyle(SOLID_FILL, 1); floodfill(130, 65, WHITE); rectangle(120, 90, 145, 100); setfillstyle(SOLID_FILL, 1); floodfill(130, 95, WHITE); ellipse(132, 125, 0, 360, 11, 8); setfillstyle(SOLID_FILL, RED); floodfill(132, 125, WHITE); circle(230, 130, 5); setfillstyle(SOLID_FILL, RED); floodfill(230, 130, WHITE); rectangle(387, 60, 427, 75); setfillstyle(SOLID_FILL, 10); floodfill(395, 70, WHITE); rectangle(385, 90, 403, 110); setfillstyle(SOLID_FILL, 6); floodfill(390, 100, WHITE); rectangle(411, 90, 430, 110); setfillstyle(SOLID_FILL, 6); floodfill(420, 100, WHITE); rectangle(387, 120, 427, 135); setfillstyle(SOLID_FILL, 10); floodfill(395, 130, WHITE); rectangle(150, 260, 510, 250); setfillstyle(SOLID_FILL, 8); floodfill(180, 255, WHITE); circle(500, 120, 6); setfillstyle(SOLID_FILL, 8); floodfill(500, 120, WHITE); setviewport(225, 300, 530, 410, 1); int poly1[] = { 0, 2, 12, 60, 22, 54, 18, 28, 35, 2, 0, 2 }; int poly2[] = { 10, 10, 23, 10, 14, 20, 10, 10 }; int poly3[] = { 50, 0, 60, 2, 60, 45, 50, 42, 50, 0 }; int poly4[] = { 71, 70, 83, 13, 105, 74, 87, 53, 71, 70 }; int poly5[] = { 85, 30, 90, 45, 83, 43, 85, 30 }; int poly6[] = { 110, 53, 120, 2, 130, 57, 148, 0, 135, 84, 132, 84, 118, 29, 110, 53 }; int poly7[] = { 177, 2, 200, 35, 180, 85, 160, 33, 177, 2 }; int poly8[] = { 178, 20, 190, 35, 179, 70, 166, 34, 178, 20 }; drawpoly(6, poly1); setfillstyle(SOLID_FILL, RED); fillpoly(6, poly1); drawpoly(4, poly2); setfillstyle(SOLID_FILL, BLACK); fillpoly(4, poly2); drawpoly(5, poly3); setfillstyle(SOLID_FILL, RED); fillpoly(5, poly3); drawpoly(5, poly4); setfillstyle(SOLID_FILL, RED); fillpoly(5, poly4); drawpoly(4, poly5); setfillstyle(SOLID_FILL, BLACK); fillpoly(4, poly5); drawpoly(8, poly6); setfillstyle(SOLID_FILL, RED); fillpoly(8, poly6); drawpoly(5, poly7); setfillstyle(SOLID_FILL, RED); fillpoly(5, poly7); drawpoly(5, poly8); setfillstyle(SOLID_FILL, BLACK); fillpoly(5, poly8); setviewport(150, 150, 510, 250, 1); pnobody(); c = getch(); do { switch (c) { case 'q': { setfillstyle(SOLID_FILL, GREEN); fillpoly(7, k1); pno(261); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k1); break; } case 'w': { setfillstyle(SOLID_FILL, RED); fillpoly(9, k2); pno(293); setfillstyle(SOLID_FILL, BLUE); fillpoly(9, k2); pnobody(); break; } case 'e': { setfillstyle(SOLID_FILL, GREEN); fillpoly(7, k3); pno(329); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k3); pnobody(); break; } case 'r': { setfillstyle(SOLID_FILL, RED); fillpoly(7, k4); pno(350); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k4); pnobody(); break; } case 't': { setfillstyle(SOLID_FILL, GREEN); fillpoly(9, k5); pno(392); setfillstyle(SOLID_FILL, BLUE); fillpoly(9, k5); pnobody(); break; } case 'y': { setfillstyle(SOLID_FILL, RED); fillpoly(9, k6); pno(440); setfillstyle(SOLID_FILL, BLUE); fillpoly(9, k6); pnobody(); break; } case 'u': { setfillstyle(SOLID_FILL, GREEN); fillpoly(7, k7); pno(493); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k7); pnobody(); break; } case 'i': { setfillstyle(SOLID_FILL, RED); fillpoly(7, k8); pno(523); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k8); pnobody(); break; } case 'o': { setfillstyle(SOLID_FILL, GREEN); fillpoly(9, k9); pno(587); setfillstyle(SOLID_FILL, BLUE); fillpoly(9, k9); pnobody(); break; } case 'p': { setfillstyle(SOLID_FILL, RED); fillpoly(7, k10); pno(659); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k10); pnobody(); break; } case '[': { setfillstyle(SOLID_FILL, GREEN); fillpoly(5, k11); pno(698); setfillstyle(SOLID_FILL, BLUE); fillpoly(5, k11); pnobody(); break; } case ']': { setfillstyle(SOLID_FILL, RED); fillpoly(5, k12); pno(784); setfillstyle(SOLID_FILL, BLUE); fillpoly(5, k12); pnobody(); break; } case '1': { setfillstyle(SOLID_FILL, YELLOW); bar(20, 0, 40, 60); pno(311); setfillstyle(SOLID_FILL, BLACK); bar(20, 0, 40, 60); pnobody(); break; } case '2': { setfillstyle(SOLID_FILL, WHITE); bar(50, 0, 70, 60); pno(370); setfillstyle(SOLID_FILL, BLACK); bar(50, 0, 70, 60); pnobody(); break; } case '4': { setfillstyle(SOLID_FILL, YELLOW); bar(110, 0, 130, 60); pno(415); setfillstyle(SOLID_FILL, BLACK); bar(110, 0, 130, 60); pnobody(); break; } case '5': { setfillstyle(SOLID_FILL, WHITE); bar(140, 0, 160, 60); pno(466); setfillstyle(SOLID_FILL, BLACK); bar(140, 0, 160, 60); pnobody(); break; } case '6': { setfillstyle(SOLID_FILL, YELLOW); bar(170, 0, 190, 60); pno(554); setfillstyle(SOLID_FILL, BLACK); bar(170, 0, 190, 60); pnobody(); break; } case '8': { setfillstyle(SOLID_FILL, WHITE); bar(230, 0, 250, 60); pno(662); setfillstyle(SOLID_FILL, BLACK); bar(230, 0, 250, 60); pnobody(); break; } case '9': { setfillstyle(SOLID_FILL, YELLOW); bar(260, 0, 280, 60); pno(740); setfillstyle(SOLID_FILL, BLACK); bar(260, 0, 280, 60); pnobody(); break; } case 'Q': { setfillstyle(SOLID_FILL, GREEN); fillpoly(7, k1); pno(261); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k1); break; } case 'W': { setfillstyle(SOLID_FILL, RED); fillpoly(9, k2); pno(293); setfillstyle(SOLID_FILL, BLUE); fillpoly(9, k2); pnobody(); break; } case 'E': { setfillstyle(SOLID_FILL, GREEN); fillpoly(7, k3); pno(329); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k3); pnobody(); break; } case 'R': { setfillstyle(SOLID_FILL, RED); fillpoly(7, k4); pno(350); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k4); pnobody(); break; } case 'T': { setfillstyle(SOLID_FILL, GREEN); fillpoly(9, k5); pno(392); setfillstyle(SOLID_FILL, BLUE); fillpoly(9, k5); pnobody(); break; } case 'Y': { setfillstyle(SOLID_FILL, RED); fillpoly(9, k6); pno(440); setfillstyle(SOLID_FILL, BLUE); fillpoly(9, k6); pnobody(); break; } case 'U': { setfillstyle(SOLID_FILL, GREEN); fillpoly(7, k7); pno(493); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k7); pnobody(); break; } case 'I': { setfillstyle(SOLID_FILL, RED); fillpoly(7, k8); pno(523); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k8); pnobody(); break; } case 'O': { setfillstyle(SOLID_FILL, GREEN); fillpoly(9, k9); pno(587); setfillstyle(SOLID_FILL, BLUE); fillpoly(9, k9); pnobody(); break; } case 'P': { setfillstyle(SOLID_FILL, RED); fillpoly(7, k10); pno(659); setfillstyle(SOLID_FILL, BLUE); fillpoly(7, k10); pnobody(); break; } case ' ': { break; } } c = getch(); } while (c != ' '); setviewport(0, 0, maxx, maxy, 1); cleardevice(); for (j = 0; j <= 1100; j++) { putpixel(random(maxx), random(maxy), 4); delay(1); } setcolor(4); outtextxy(270, 150, "C R E D I T S"); for (int i = 0; i <= 3; i++) { outtextxy(260, 155 + i, "_______________"); } delay(600); outtextxy(150, 200, " #Suvojit Manna:Concept & Design,Core Programing"); outtextxy(160, 205, "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ "); delay(600); outtextxy(165, 250, " #Prangshu Shyam:Graphical Assisstance"); outtextxy(180, 255, "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ "); delay(600); outtextxy(200, 300, " #Sourav Kundu:Final Compilation"); outtextxy(210, 305, "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ "); getch(); return 0; }
int showmenu() { int gd=DETECT, gm; int i,j; int k; initgraph(&gd,&gm,"c:\\tc\\bgi"); setbkcolor(YELLOW); setcolor(BROWN); rectangle(120,85,490,385); rectangle(130,95,500,395); setcolor(GREEN); settextstyle(4,0,4); outtextxy(110,35,"_-~ Search for me... ~-_"); settextstyle(7,0,3); setcolor(BROWN); outtextxy(180,105,"ENTER YOUR CHOICE:"); settextstyle(2,0,0); setcolor(BROWN); outtextxy(230,145,"[1]. Add a word. ->"); outtextxy(230,170,"[2]. Find meaning. ->"); outtextxy(230,195,"[3]. Display all. ->"); outtextxy(230,220,"[4]. Change meaning of a word.->"); outtextxy(230,245,"[5]. Display History.->"); outtextxy(230,270,"[6]. Save and Close,->"); outtextxy(230,295,"Enter choice... ->"); gotoxy(250,300); scanf("%d",&k); for(i=0;i<636;i++) { if(i==635) { for(j=0;j<480;j++) { circle(635,j,4); delay(1); } } else { circle(i,5,5); delay(1); } } for(i=639;i>(-1);i--) { if(i==0) { for(j=475;j>0;j--) { circle(5,j,5); delay(1); } } else { circle(i,475,4); delay(1); } } restorecrtmode(); return (k); }
void main() { char pass[10],npass[10],c,p[10]; char *cp; struct stack s; int i,j,k; int gd=DETECT,gm; FILE *fpass; clrscr(); fpass=fopen("c:\\password.txt","r"); //first(); initgraph(&gd,&gm,"c:\\tc\\bgi"); rectangle(10,405,430,550); rectangle(30,415,480,575); setcolor(GREEN); settextstyle(4,0,4); outtextxy(200,350,"_-~ Search for me... ~-_"); settextstyle(7,0,3); setcolor(BROWN); /* if(fpass==NULL) { printf("no password exist...\n\n"); printf("\n\t\tset a new password\n\n"); printf("enter password:"******"%d",pass); for(*cp=pass[0];*cp!='\0';cp+1) j++; printf("%d",j); for(k=0;k<4;k++) { printf("%c",pass[k]); push(&s,pass[k]); } fpass=fopen("c:\\password.txt","w"); for(k=0;k<4;k++) { c=pop(&s); fprintf(fpass,"%c",c); } fclose(fpass); } fpass=fopen("c:\\password.txt","r"); for(k=0;!feof(fpass);k++) { fscanf(fpass,"%c",npass[k]); } fclose(fpass); printf("\t Enter password :"******"%s",&p); */ if(1) { //intro(); prog(); getch(); } else { end(); // exit(1); } }
void drawboard(int startx, int starty, int blocksize) { //Integers declaration int iter,iterx,itery; //Constant integers decalaration int scale = blocksize * 15; setcolor(BLACK); //Draw boxes for ludo board:- //~~~~~~~~~~~~~~~~~~~~~~~~~ { int locationfromx, locationfromy, locationtox, locationtoy; for (iter = 1; iter <=4; iter++) { switch(iter) { case 1: // For the upper portion locationfromx = 6; locationfromy = 0; locationtox = 8; locationtoy = 5; break; case 2: // For the left portion locationfromx = 0; locationfromy = 6; locationtox = 5; locationtoy = 8; break; case 3: // For the right locationfromx = 9; locationfromy = 6; locationtox = 14; locationtoy = 8; break; case 4: // For the lower portion locationfromx = 6; locationfromy = 9; locationtox = 8; locationtoy = 14; break; } for(itery = (blocksize*locationfromy) + starty; itery <= (blocksize * locationtoy) + starty; itery = itery + blocksize) for(iterx = (blocksize*locationfromx)+startx; iterx <= (blocksize * locationtox) + startx; iterx = iterx + blocksize) { rectangle (iterx, itery, iterx + blocksize, itery + blocksize); } } // Draw home in middle line(startx + blocksize * 6, starty + blocksize * 6, startx + blocksize * 9, starty + blocksize * 9); line(startx + blocksize * 9, starty + blocksize * 6, startx + blocksize * 6, starty + blocksize * 9); setfillstyle(SOLID_FILL, BLUE); floodfill( startx + blocksize * 6.5, starty + blocksize * 7.5, BLACK); setfillstyle(SOLID_FILL, GREEN); floodfill( startx + blocksize * 7.5, starty + blocksize * 6.5, BLACK); setfillstyle(SOLID_FILL, RED); floodfill( startx + blocksize * 8.5, starty + blocksize * 7.5, BLACK); setfillstyle(SOLID_FILL, YELLOW); floodfill( startx + blocksize * 7.5, starty + blocksize * 8.5, BLACK); setcolor(BLACK); setfillstyle(SOLID_FILL, WHITE); fillellipse(startx + blocksize * 7.5, starty + blocksize * 7.5, blocksize, blocksize); settextjustify(CENTER_TEXT, CENTER_TEXT); outtextxy(startx + blocksize * 7.5, starty + blocksize * 7.5, "Home"); } //End draw boxes //Draw blue player's home area setcolor(BLUE); setfillstyle(CLOSE_DOT_FILL, BLUE); bar(startx, starty, startx + blocksize * 6 - 1, starty + blocksize * 6 - 1); setfillstyle(SOLID_FILL, WHITE); bar(startx + blocksize * 0.5, starty + blocksize * 0.5, startx + blocksize * 5.5, starty + blocksize * 5.5); setfillstyle(SOLID_FILL, BLUE); circle(startx + blocksize + blocksize / 2 , starty + blocksize + blocksize / 2 , blocksize / 2 ); circle(startx + blocksize * 4 + blocksize / 2 , starty + blocksize + blocksize / 2 , blocksize / 2 ); circle(startx + blocksize + blocksize / 2 , starty + blocksize * 4 + blocksize / 2 , blocksize / 2 ); circle(startx + blocksize * 4 + blocksize / 2 , starty + blocksize * 4 + blocksize / 2 , blocksize / 2 ); line(startx + blocksize * 2, starty + blocksize * 1.5, startx + blocksize * 2 , starty + blocksize * 4.5); line(startx + blocksize * 4, starty + blocksize * 1.5, startx + blocksize * 4 , starty + blocksize * 4.5); line(startx + blocksize * 1.5, starty + blocksize * 2, startx + blocksize * 4.5, starty + blocksize * 2); line(startx + blocksize * 1.5, starty + blocksize * 4, startx + blocksize * 4.5, starty + blocksize * 4); floodfill(startx + blocksize * 2.5, starty + blocksize * 2.5, BLUE); //Draw green player's home area setcolor(GREEN); setfillstyle(CLOSE_DOT_FILL, GREEN); bar(startx + blocksize * 9 + 1, starty, startx + blocksize * 15, starty + blocksize * 6 - 1); setfillstyle(SOLID_FILL, WHITE); bar(startx + blocksize * 9.5, starty + blocksize * 0.5, startx + blocksize * 14.5, starty + blocksize * 5.5); setfillstyle(SOLID_FILL, GREEN); circle(startx + blocksize * 10.5, starty + blocksize * 1.5, blocksize / 2 ); circle(startx + blocksize * 13.5, starty + blocksize * 1.5, blocksize / 2 ); circle(startx + blocksize * 10.5, starty + blocksize * 4.5, blocksize / 2 ); circle(startx + blocksize * 13.5, starty + blocksize * 4.5, blocksize / 2 ); line(startx + blocksize * 11, starty + blocksize * 1.5, startx + blocksize * 11 , starty + blocksize * 4.5); line(startx + blocksize * 13, starty + blocksize * 1.5, startx + blocksize * 13 , starty + blocksize * 4.5); line(startx + blocksize * 10.5, starty + blocksize * 2, startx + blocksize * 13.5, starty + blocksize * 2); line(startx + blocksize * 10.5, starty + blocksize * 4, startx + blocksize * 13.5, starty + blocksize * 4); floodfill(startx + blocksize * 12, starty + blocksize * 2.5, GREEN); //Draw yellow player's home area setcolor(BLACK); setfillstyle(CLOSE_DOT_FILL, YELLOW); bar(startx, starty + blocksize * 9 + 1, startx + blocksize * 6 - 1, starty + blocksize * 15); setfillstyle(SOLID_FILL, WHITE); bar(startx + blocksize * 0.5, starty + blocksize * 9.5, startx + blocksize * 5.5, starty + blocksize * 14.5); setfillstyle(SOLID_FILL, BLACK); circle(startx + blocksize * 1.5, starty + blocksize * 10.5, blocksize / 2 ); circle(startx + blocksize * 4.5, starty + blocksize * 10.5, blocksize / 2 ); circle(startx + blocksize * 1.5, starty + blocksize * 13.5 , blocksize / 2 ); circle(startx + blocksize * 4.5, starty + blocksize * 13.5 , blocksize / 2 ); line(startx + blocksize * 2, starty + blocksize * 10.5, startx + blocksize * 2 , starty + blocksize * 13.5); line(startx + blocksize * 4, starty + blocksize * 10.5, startx + blocksize * 4 , starty + blocksize * 13.5); line(startx + blocksize * 1.5, starty + blocksize * 11, startx + blocksize * 4.5, starty + blocksize * 11); line(startx + blocksize * 1.5, starty + blocksize * 13, startx + blocksize * 4.5, starty + blocksize * 13); floodfill(startx + blocksize * 2.5, starty + blocksize * 11.5, BLACK); //Draw red player's home area setcolor(RED); setfillstyle(CLOSE_DOT_FILL, RED); bar(startx + blocksize * 9 + 1, starty + blocksize * 9 + 1, startx + blocksize * 15, starty + blocksize * 15); setfillstyle(SOLID_FILL, WHITE); bar(startx + blocksize * 9.5, starty + blocksize * 9.5, startx + blocksize * 14.5, starty + blocksize * 14.5); setfillstyle(SOLID_FILL, RED); circle(startx + blocksize * 10.5, starty + blocksize * 10.5, blocksize / 2 ); circle(startx + blocksize * 13.5, starty + blocksize * 10.5, blocksize / 2 ); circle(startx + blocksize * 10.5, starty + blocksize * 13.5, blocksize / 2 ); circle(startx + blocksize * 13.5, starty + blocksize * 13.5, blocksize / 2 ); line(startx + blocksize * 11, starty + blocksize * 10.5, startx + blocksize * 11 , starty + blocksize * 13.5); line(startx + blocksize * 13, starty + blocksize * 10.5, startx + blocksize * 13 , starty + blocksize * 13.5); line(startx + blocksize * 10.5, starty + blocksize * 11, startx + blocksize * 13.5, starty + blocksize * 11); line(startx + blocksize * 10.5, starty + blocksize * 13, startx + blocksize * 13.5, starty + blocksize * 13); floodfill(startx + blocksize * 12, starty + blocksize * 11.5, RED); //Draw stops and home paths on board for(iterx = 0; iterx <= 5; iterx++) for(itery = 6; itery <= 8; itery++) drawblock(iterx,itery); for(iterx = 6; iterx <= 8; iterx++) for(itery = 0; itery <= 5; itery++) drawblock(iterx,itery); for(iterx = 9; iterx <= 14; iterx++) for(itery = 6; itery <= 8; itery++) drawblock(iterx,itery); for(iterx = 6; iterx <= 8; iterx++) for(itery = 9; itery <= 14; itery++) drawblock(iterx,itery); }
void layout() { floodfill(0,0,WHITE); setbkcolor(WHITE); setcolor(BLACK); settextstyle(0,0,1); outtextxy(1,55,"credit"); setbkcolor(BLACK); rectangle(1,55,48,65); rectangle(1,6,291,52); //off setfillstyle(SOLID_FILL,BLACK); bar(230,75,280,125); setcolor(RED); settextstyle(2,0,6); outtextxy(237,90,"OFF"); //del,squreroot setfillstyle(SOLID_FILL,BLACK); bar(175,75,225,125); bar(108,75,156,125); bar(56,75,104,125); bar(4,75,52,125); setcolor(RED); settextstyle(2,0,6); outtextxy(182,90,"DEL"); line(125,90,142,90); line(125,90,123,107); line(123,107,120,102); outtextxy(128,91,"x"); outtextxy(71,91,"%"); outtextxy(20,91,"x"); settextstyle(2,0,4); outtextxy(30,87,"n"); //9,8,7 setfillstyle(SOLID_FILL,BLACK); bar(4,138,52,188); bar(56,138,104,188); bar(108,138,156,188); setcolor(RED); settextstyle(2,0,6); outtextxy(20,153,"7"); outtextxy(72,153,"8"); outtextxy(124,153,"9"); //6,5,4 setfillstyle(SOLID_FILL,BLACK); bar(4,192,52,246); bar(56,192,104,246); bar(108,192,156,246); setcolor(RED); settextstyle(2,0,6); outtextxy(20,207,"4"); outtextxy(72,207,"5"); outtextxy(124,207,"6"); //3,2,1 setfillstyle(SOLID_FILL,BLACK); bar(4,250,52,300); bar(56,250,104,300); bar(108,250,156,300); setcolor(RED); settextstyle(2,0,6); outtextxy(20,265,"1"); outtextxy(72,265,"2"); outtextxy(124,265,"3"); //0 setfillstyle(SOLID_FILL,BLACK); bar(4,304,52,354); bar(56,304,104,354); bar(108,304,156,354); setcolor(RED); settextstyle(2,0,6); outtextxy(25,315,"."); outtextxy(72,319,"0"); outtextxy(114,319,"ANS"); //+,- setfillstyle(SOLID_FILL,BLACK); bar(175,138,225,246); bar(175,250,225,300); setcolor(RED); settextstyle(2,0,6); outtextxy(195,183,"+"); outtextxy(195,265,"-"); //c,*,/ setfillstyle(SOLID_FILL,BLACK); bar(229,138,279,188); bar(229,192,279,246); bar(229,250,279,300); setcolor(RED); settextstyle(2,0,6); outtextxy(245,153,"C"); outtextxy(245,207,"X"); outtextxy(250,265,"/"); //= setfillstyle(SOLID_FILL,BLACK); bar(200,304,250,354); setcolor(RED); settextstyle(2,0,6); outtextxy(218,319,"="); }
int MenuProvas ( void ) { static char *Opcoes[NUMOPC] = { " POS SIMPLES ", " BRONCO-DILATACAO ", " BRONCO-PROVOCACAO ", "ESPIROMETRIA DE ESFORCO", " RETORNAR " }; int cont = 0, Lin[NUMOPC], alt; int i, corf, corb; Lin[0] = 5; Lin[1] = 25; Lin[2] = 45; Lin[3] = 65; Lin[4] = 85; AtivaJanelaGrafica(MENU_2,0); clearviewport (); setcolor (bea_color[14]); getviewsettings(&vp); clearviewport(); alt = CharH; for ( i = 0; i < NUMOPC; i++ ) { setviewport( vp.left , vp.top + DELTA_Y(Lin[i]) - 1, vp.right, vp.top + DELTA_Y(Lin[i]) + 1 + alt, 1); clearviewport(); if ( cont == i ) { corb = bea_color[14]; corf = bea_color[ 0]; } else { corb = bea_color[ 0]; corf = bea_color[14]; } setfillstyle(1, corb); floodfill(1,1,1); setcolor(corf); outtextxy( DELTA_X(50) - textwidth(Opcoes[i])/2, 2, Opcoes[i]); } do { LimpaBufferTeclado(); sc.c = LeTeclado(); if (sc.ch[0] == 0) if (sc.ch[1]==72 || sc.ch[1]==80) { setviewport( vp.left , vp.top + DELTA_Y(Lin[cont]) - 1, vp.right, vp.top + DELTA_Y(Lin[cont]) + 1 + alt, 1); clearviewport(); setcolor(bea_color[14]); outtextxy( DELTA_X(50) - textwidth(Opcoes[cont])/2, 2, Opcoes[cont]); if (sc.ch[1]==72) { if (--cont < 0) cont = NUMOPC - 1; } else { cont = (cont + 1) % NUMOPC; } setviewport( vp.left , vp.top + DELTA_Y(Lin[cont]) - 1, vp.right, vp.top + DELTA_Y(Lin[cont]) + 1 + alt, 1); clearviewport(); setfillstyle(1, bea_color[14]); floodfill(1,1,1); setcolor(bea_color[0]); outtextxy( DELTA_X(50) - textwidth(Opcoes[cont])/2, 2, Opcoes[cont]); } } while(sc.ch[0] != ENTER); setviewport(vp.left,vp.top,vp.right,vp.bottom,1); return(cont); } /* End of MenuProvas () */
void displaygraphics (int n, struct process* pr1){ int gd = DETECT, gm = VGAMAX; int x, y, i, j; struct process *base = pr1; char m[] = "PBS"; char p[100]; char id[50]; initgraph (&gd, &gm, 0); moveto (0, 0); x = getmaxx (); y = getmaxy (); setcolor (BLUE); rectangle (0, 0, x, y); line (0, y / 3, x, y / 3); setfontcolor (RED); for(i=0; i<n; ++i,++base){ sprintf (p, "Process %d", i + 1); outtextxy (x / n * i, 20, p); sprintf (p, "ID %5u", base->pid); outtextxy (x / n * i, 50, p); sprintf (p, "AT%5u", base->at); outtextxy (x / n * i, 60, p); sprintf (p, "BT %5u", base->bt); outtextxy (x / n * i, 70, p); sprintf (p, "Priority %5u", base->Priority); outtextxy (x / n * i, 90, p); line (x / n * i, 0, x / n * i, y / 3); } //Second Block of Display outtextxy (x / 3, 5 + y / 3, m); setcolor (BLUE); bar (x / 3 + 20, y / 3 + 30, x / 3 + 100, y / 3 + 100); sorting (n, pr1, 20); for (i = 0; i < n; i++){ for (j = 0; j < n; j++){ if ( (pr1[i].Priority) == (pr2[j].Priority) ){ setcolor (BLUE); bar (x / 3 + 20, y / 3 + 30, x / 3 + 100, y / 3 + 100); sprintf (id, "pid%d", pr2[j].pid); outtextxy (x / 3 + 30, y / 3 + 55, id); delay (2000); setfontcolor (BLUE); } } setfontcolor (RED); } setcolor (BLUE); line (0, 2 * y / 3, x, 2 * y / 3); // Third Block of Graphics for (i = 0; i < n; i++){ for (j = 0; j < n; j++){ if ( (pr1[i].Priority) == (pr2[j].Priority) ){ sprintf (id, "pid%d", pr2[j].pid); outtextxy (x / n * i, 2 * (y / 3) + 50, id); delay (2000); } } line (x / n * i, 2 * y / 3, x / n * i ,y); } delay (2000); outtextxy (x - 150, y - 20, "Tapasweni Pathak"); while (!kbhit ()); closegraph (); }
int main(void) { int gdriver = DETECT, gmode, errorcode,lin=160,col=320,r=70,li, co,sta,C,L; char msg[]=" Eu te amo!!!!!!! ",ma[]="Marclaine!!!!...",m[1]; int n[16],i,j,l=1; n[0]=50;n[1]=110;n[2]=152;n[3]=189;n[4]=229;n[5]=254;n[6]=296;n[7]=323; n[8]=373;n[9]=413;n[10]=435;n[11]=457;n[12]=479;n[13]=501;n[14]=523;n[15]=545; initgraph(&gdriver, &gmode, "c:\\bc\\bgi"); errorcode = graphresult(); if (errorcode != grOk) { printf("Graphics error: %s\n", grapherrormsg(errorcode)); exit(1); } setcolor(9); settextstyle(TRIPLEX_FONT, HORIZ_DIR, 8); for(i=0;ma[i]!='\0';i++){ for(j=480;j>=60;j--){ m[0]=ma[i]; m[1]='\0'; setcolor(l); outtextxy(n[i],j,m); delay(10); setcolor(0); outtextxy(n[i],j,m);} setcolor(l); outtextxy(n[i],j,m);l++; if(l==16) l=1;} mouse(); for(i=480;i>=240;i--){ mousexy(i,320); delay(10);} botao(300,200,330,230,0); li=(linmouse()*8); co=(colmouse()*8); sta=status(); while(!(co>=300 && co<=330 && li>=200 && li<=230) && sta!=1){ sta=status();} C=0; L=0; while(sta==1) { if(C==0 && L==0) botao(300,200,330,230,1); C=1; sta=status(); li=(linmouse()*8); co=(colmouse()*8); if(!(co>=300 && co<=330 && li>=200 && li<=230)){ if(C==1 && L==0) botao(300,200,330,230,0); sta=1;L=1;} else if(C==1 && L==1){ L=0;C=0;} } desliga(); cleardevice(); setcolor(4); settextstyle(TRIPLEX_FONT, HORIZ_DIR, 6); settextjustify(CENTER_TEXT, CENTER_TEXT); outtextxy(270,28, msg); while(!(kbhit())){ for(r=0;r<90;r++){ setcolor(4); cardio(col,lin,r); delay(9); if(kbhit()) break;} for(;r>-1;r--){ delay(9); setcolor(0); cardio(col,lin,r); if(kbhit()) break;}} getch(); closegraph(); return 0; }
int main() { mkdir(Menufold); char sorcepath[100]; int i; char Ch; fstream fin; fstream foutMenu; fstream foutDesk; screenMain(); stanterdScreen(50,1,9); strcpy(sorcepath,"C:\\MISION\\HELP\\Ad_Book.PIF"); fin.open("C:\\MISION\\VISION\\Ad_Book.PIF",ios::nocreate|ios::in); if(!fin) { cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tFirst Use INSTAL.EXE\n\n\n\n\n"; getch(); exit(0); } fin.close(); fin.open(sorcepath,ios::nocreate|ios::in|ios::binary); if(fin) { foutDesk.open(Desktop,ios::out|ios::trunc|ios::binary); foutMenu.open(StartMenu,ios::out|ios::trunc|ios::binary); } else { cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tError In Process\n\n\t\t\t\tAborted !"; getch(); exit(0); } while(fin) { fin.get(Ch); foutDesk.put(Ch); foutMenu.put(Ch); } fin.close(); foutDesk.close(); foutMenu.close(); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\tDesktop Shortcut Is Created\n\n\t\t\tFile Is Added To Start Menu \n\n\n\n"; fin.open("C:\\MISION\\help\\help.htm",ios::nocreate|ios::in); foutMenu.open(StartMenuhtm,ios::out|ios::trunc|ios::binary); while(fin) { fin.get(Ch); foutMenu.put(Ch); }; fin.close(); foutMenu.close(); stanterdScreen(50,1,9); forMyCollege(); delay(250); Report(11,"Graphics&Header","dreamBlitzer"); Report(11,"Mouse","CCoder"); Report(11,"Data Management","MadCoder"); Report(11,"File & Storage","Looxers"); Report(11,"Desktop & Menu","dreamBlitzer"); setcolor(11); sprintf(msg1,"Thank You"); outtextxy(((getmaxx()-(textwidth(msg1)))/2),getmaxy()/2-50,msg1); initMouse(); showMouse(); setMouseCurserPosition(50,50); outtextxy(180,275,"Press Esc To Exit . . . !"); do { i=getBiosKey(); } while(i!=ESC); return(0); }
void plotout(int x,int y,int z) { int p,q; plot(x,y,z,p,q); outtextxy(p,q,""); }
int main() { int unidad = DETECT, modo,boton,Horiz,Vert; char a[10],todo[30]; MOUSE 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(); getch(); boton = mouse.Estado (&Vert,&Horiz); itoa (Horiz,a,10); strcpy (todo,a); itoa (Vert,a,10); strcat (todo," "); strcat (todo,a); itoa (boton,a,10); strcat (todo," "); strcat (todo,a); mouse.Esconder(); outtextxy (0,0,todo); mouse.Mostrar(); getch(); boton = mouse.Estado (&Vert,&Horiz); itoa (Horiz,a,10); strcpy (todo,a); itoa (Vert,a,10); strcat (todo," "); strcat (todo,a); itoa (boton,a,10); strcat (todo," "); strcat (todo,a); mouse.Esconder(); outtextxy (0,10,todo); mouse.Mostrar(); getch(); boton = mouse.Estado (&Vert,&Horiz); itoa (Horiz,a,10); strcpy (todo,a); itoa (Vert,a,10); strcat (todo," "); strcat (todo,a); itoa (boton,a,10); strcat (todo," "); strcat (todo,a); mouse.Esconder(); outtextxy (0,20,todo); mouse.Mostrar(); getch(); closegraph(); return 0; }
main() { int mode=VGAHI,driver=VGA; char ch; unsigned int l; int i,gi,gj,j,flag=1;/*i,j是循环变量,flag是标记变量,-1:向x负半轴移动,+1:向x正半轴移动*/ double qx,qy,k,b=0.0,speech=0.4,x,y; double r=2.0,bx=60.0,byy=270.0; double pianx=100.0,piany=100.0,tx=20.0,ty=10.0,jx=2.0,jy=2.0; int mx=0,my=0,mb,sum;/*sum纪录砖块的数目*/ FILE * p; if((p = fopen("record.dat", "r")) == NULL) { p=fopen("record.dat","w"); fprintf(p,"0 0 0 0 0\n"); rewind(p); } fclose(p); initgraph(&driver,&mode,"C:\\tc"); setbkcolor(BLUE); Msinit(); Setmouse((int)(pianx+1+bx/2),(int)((tx+jx)*8+pianx-1-bx/2),(int)byy+piany,(int)byy+piany); star: cleardevice();/*程序重载的介入点*/ setcolor(RED); outtextxy(30,20,"^_^ Welcome to Play Hitting Brick Game! ^_^"); sum=0; qx=100.0+pianx-10;qy=180.0+pianx-10;k=0.33; setcolor(7); rectangle((int)(pianx-2),(int)(piany-2),(int)((tx+jx)*8+2+pianx),302+piany); setcolor(1); rectangle((int)(pianx-1),(int)(piany-1),(int)((tx+jx)*8+1+pianx),301+piany); /*读取盘面情况*/ p=fopen("record.dat", "r"); for(i=0;i<5;i++) fscanf(p,"%x ",&zhuan[i]); fclose(p); /*画砖块*/ for(i=0;i<5;i++) { l=1; for(j=0;j<16;j++) { if((zhuan[i]&l)==0) { Draw((int)((jx+tx)*((16*i+j)%8)+pianx+jx),(int)((jy+ty)*((int)((16*i+j)/8))+piany+jy),(int)tx,(int)ty); sum+=1; } l=l*2; } } gotoxy(5,4); printf("Press any key to start game...Q key to quit..."); ch=getch(); if(ch=='q'||ch=='Q') quitgame(); else { gotoxy(5,4); printf(" "); } for(;;) { setfillstyle(1, 0); bar(mx-bx/2,my,mx+bx/2,my+5); Msread(&mx, &my, &mb); Draw(mx-bx/2,my,bx,5); setcolor(0); mycircle(qx,qy,r,0); /*判断求是否反弹*/ if(qx-r<=pianx+1 || qx+r>=(tx+jx)*8+pianx-1) { flag=-flag; k=-k; } if(qy-r<=piany+1) k=-k; for(gi=0;gi<5;gi++) { l=1; for(gj=0;gj<16;gj++) { if((zhuan[gi]&l)==0) { j=(16*gi+gj)/8; i=(16*gi+gj)%8; x=(jx+tx)*i+jx+tx/2+pianx; y=(jy+ty)*j+jy+ty/2+piany; /*边判断1*/ if(qy>=y-ty/2 && qy<=y+ty/2 &&(pow(qx+r-x+tx/2,2)<1 || pow(qx-r-x-tx/2,2)<1)) { flag=-flag; k=-k; zhuan[gi]=zhuan[gi]|l; sum-=1; if(sum==0) wingame(); setfillstyle(1, 0); bar((jx+tx)*i+pianx+jx,(jy+ty)*j+piany+jy,(jx+tx)*i+pianx+jx+tx,(jy+ty)*j+piany+jy+ty); } else /*边判断2*/ if(qx>=x-tx/2 && qx<=x+tx/2 &&(pow(qy+r-y+ty/2,2)<1 || pow(qy-r-y-ty/2,2)<1)) { k=-k; zhuan[gi]=zhuan[gi]|l; sum-=1; if(sum==0) wingame(); setfillstyle(1, 0); bar((jx+tx)*i+pianx+jx,(jy+ty)*j+piany+jy,(jx+tx)*i+pianx+jx+tx,(jy+ty)*j+piany+jy+ty); } else /*角判断*/ if(pow(qx-x+tx/2,2)+pow(qy-y+ty/2,2)<=r*r || pow(qx-x-tx/2,2)+pow(qy-y+ty/2,2)<=r*r || pow(qx-x+tx/2,2)+pow(qy-y-ty/2,2)<=r*r || pow(qx-x-tx/2,2)+pow(qy-y-ty/2,2)<=r*r) { flag=-flag; zhuan[gi]=zhuan[gi]|l; sum-=1; if(sum==0) wingame(); setfillstyle(1, 0); bar((jx+tx)*i+pianx+jx,(jy+ty)*j+piany+jy,(jx+tx)*i+pianx+jx+tx,(jy+ty)*j+piany+jy+ty); } } l=l*2; } } /*棍棒的反弹*/ if(qx<=mx+bx/2 && qx>=mx-bx/2 && pow(qy+r-my,2)<1) { k=-(k/pow(k*k,0.5))*(0.3*bx/(pow(pow(qx-mx,2),0.5)+0.000001)); } if((int)(qy+r)>my+0.5) { gotoxy(5,5); printf("You have lost the game!Press any key to restart..."); getch(); goto star; } b=qy-qx*k; if(flag==1) qx=qx+speech/pow(1.0+k*k,0.5); if(flag==-1) qx=qx-speech/pow(1.0+k*k,0.5); qy=qx*k+b;/*计算球心坐标*/ setcolor(14); mycircle((int)qx,(int)qy,r,14); delay(1); if(mb==1) { gotoxy(5,5); printf("You have lost the game!Press any key to restart..."); getch(); goto star; } } }
void main() { int modo=DETECT,drive,resp; initgraph(&modo,&drive,"c:\\bc\\bgi"); inicio: setcolor(4); setfillstyle( SOLID_FILL,4); resp=linha(247,179,432,320,4); if(resp==1) goto inicio; for(i=6.8;i>6.4;i-=0.005) { col=cos(i)*160 + 320; lin=sin(i)*160 + 170; setcolor(4); cardio(col,lin,4); cardio(640-col,lin,4); setcolor(0); cardio2(col,lin,4); cardio2(col,lin,5); cardio2(col,lin,6); cardio2(col,lin,7); cardio2(640-col,lin,4); cardio2(640-col,lin,5); cardio2(640-col,lin,6); cardio2(640-col,lin,7); delay(1); if(num>9 && num<13) if(i<mt[num]) { num++; goto inicio; } } for(i=6.5;i>3.2;i-=0.005) { col=cos(i)*80 + 400; lin=sin(i)*80 + 170; setcolor(4); cardio(col,lin,4); cardio(640-col,lin,4); setcolor(0); cardio2(col,lin,4); cardio2(col,lin,5); cardio2(col,lin,6); cardio2(col,lin,7); cardio2(640-col,lin,4); cardio2(640-col,lin,5); cardio2(640-col,lin,6); cardio2(640-col,lin,7); delay(1); if(num<10) if(i<mt[num]) { num++; goto inicio; } } cleardevice(); setcolor(4); cardio(320,165,4); for(i=650;i>25;i--) { setcolor(4); outtextxy(i,200,"No final, Dois coracoes apaixonados sempre se encontram em um so coracao. "); delay(50); setcolor(0); outtextxy(i,200,"No final, Dois coracoes apaixonados sempre se encontram em um so coracao. "); } setcolor(4); outtextxy(i,200,"No final, Dois coracoes apaixonados sempre se encontram em um so coracao. "); getch(); }
void Welcome() { Mouse m; setbkcolor(WHITE); setviewport(40, 40, 600, 440, 1); setfillstyle(SOLID_FILL, LIGHTCYAN); setcolor(YELLOW); rectangle(0, 0, 560, 400); floodfill(50, 50, 14); setviewport(40, 40, 580, 420, 1); rectangle(20, 20, 540, 380); setfillstyle(SOLID_FILL, LIGHTMAGENTA); floodfill(21, 300, YELLOW); setcolor(BLACK); settextstyle(TRIPLEX_FONT, HORIZ_DIR, 8); outtextxy(110, 55, "Welcome"); DisChinese("今天你是设计师",170,165,2,2,10,10); setcolor(BLUE); setfillstyle(SOLID_FILL, YELLOW); ellipse(450,335,0,360,60,20); floodfill(450, 335, BLUE); DisChinese("开始",430,328,1,1,20,DARKGRAY); setcolor(WHITE); setfillstyle(SOLID_FILL, WHITE); arc(260,818,85,130,470); arc(270,820,85,130,470); arc(285,822,85,130,470); line(61,227,74,400); line(61,227,164,211); line(164,211,174,360); line(184,277,254,265); line(184,277,190,355); line(254,265,260,355); bar(85,245,108,270); bar(131,245,155,270); bar(85,300,108,330); bar(131,300,155,330); bar(199,287,215,302); bar(230,282,246,298); bar(199,320,215,335); bar(230,320,246,335); while (1) { ShowMouse(); m=ReadMouse(); if (m.b == 1) { if (MouseIn(430,305,500,395)) { HideMouse(); cleardevice(); closegraph(); break; } } } }
void rules() { initgraph(850,600); setbkcolor(DARKGRAY); cleardevice(); setcolor(LIGHTGREEN); setfont(60,0,"华文隶书"); outtextxy(270,1,"游戏介绍"); setcolor(LIGHTCYAN); setfont(40,0,"华文行楷"); outtextxy(20,65,"1.黄颜色的小方块表示美味的食物。"); outtextxy(20,110,"2.紫色的实心小圆表示可恶的地雷。"); outtextxy(20,160,"3.绿色的实心小圆表示可恨的毒草。"); outtextxy(20,210,"4.小蛇每吃到一个食物,身体便会增加一节。"); outtextxy(20,260,"5.小蛇碰到地雷,身体会被炸掉一半。要小心哦!!"); outtextxy(20,310,"6,小蛇碰到毒草,身体会变短一节。要小心哦!!"); outtextxy(20,360,"7.小蛇的头撞到四周的墙会死。"); outtextxy(20,410,"8.小蛇的头撞到自己的身体也会死亡。"); outtextxy(20,460,"9.用鼠标点击下面的“→”区域,回到主页面。"); outtextxy(20,510,"10.祝您好运!!!"); setcolor(BROWN); setfont(60,0,"华文隶书"); outtextxy(580,520,"→主页面"); MOUSEMSG m; while(true) { m=GetMouseMsg(); switch(m.uMsg) { case WM_LBUTTONDOWN: if(m.x>=580&&m.y>=520&&m.y<=580&&m.x<=820) main(); } } }
main() { initwindow(300,370); int remark,i,j,k,dp; float num[100]={0},number[100]= {0},ans; char task; task='\0'; i=0; j=0; ans=0; dp=-1; layout(); setviewport(3,8,290,50,1); getclick: clearmouseclick(513); setbkcolor(WHITE); clearviewport(); setcolor(RED); settextstyle(2,1,10); char c[100]; if((number[j]==0||number[j]==1)&&j!=0&&i!=1) { k=j-1; } else { k=j; } if(number[k]-(int)number[k]==0) { sprintf(c,"%.0f",number[k]); } else { sprintf(c,"%.4f",number[k]); } outtextxy(280,45,c); if(task!='S'&&task!='^') { settextstyle(2,1,6); sprintf(c,"%c",task); outtextxy(10,25,c); } delay(500); if(ismouseclick(513)==1) { getclick1: remark=click(); if(remark==-1000) { number[j]=numgen(num,i,dp); goto getclick; } else if(remark==-100) { return 0; } else if(remark>=0&&remark<=9) { if(task=='S') { j++; i=0; task='\0'; } num[i]=remark; i++; number[j]=numgen(num,i,dp); clearviewport(); delay(25); goto getclick; } else if(remark==-1) { if(i==dp) { dp=-1; } i--; if(i<0) { i=0; } number[j]=numgen(num,i,dp); clearviewport(); delay(25); goto getclick; } else if(remark==-2) { dp=i; //number[j]=numgen(num,i,dp); clearviewport(); delay(25); goto getclick; } //calculate = else if(remark==12) { if(num[0]-(int)num[0]==0) { number[j]=numgen(num,i,dp); } else { number[j]=num[0]; } if(task=='+') { number[j]=add(number[j-1],number[j]); } else if(task=='-') { number[j]=sub(number[j-1],number[j]); } else if(task=='x') { number[j]=mul(number[j-1],number[j]); } else if(task=='/') { number[j]=divi(number[j-1],number[j]); } else if(task=='^') { number[j]=pow(number[j-1],number[j]); } clearviewport(); ans=number[j]; while(1) { delay(50); setbkcolor(WHITE); settextstyle(2,1,10); if(task=='/'&&number[j]==-1) { settextstyle(2,1,8); outtextxy(285,35,"MATH ERROR"); } else if(number[j]-(int)number[j]==0) { sprintf(c,"%.0f",number[j]); outtextxy(280,45,c); } else { sprintf(c,"%.4f",number[j]); outtextxy(285,45,c); } delay(500); if(ismouseclick(513)) { i=0; j=0; number[j]=0; dp=-1; task='\0'; clearviewport(); delay(50); goto getclick1; } } } else if(remark==11) { if(num[0]-(int)num[0]==0) { number[j]=numgen(num,i,dp); } else { number[j]=num[0]; } if(task=='+') { number[j]=add(number[j-1],number[j]); } else if(task=='-') { number[j]=sub(number[j-1],number[j]); } else if(task=='x') { number[j]=mul(number[j-1],number[j]); } else if(task=='/') { number[j]=divi(number[j-1],number[j]); } else if(task=='^') { number[j]=pow(number[j-1],number[j]); } j++; i=0; number[j]=0; dp=-1; task='+'; clearviewport(); delay(25); goto getclick; } else if(remark==13) { i=0; j=0; number[j]=0; task='\0'; goto getclick; } else if(remark==14) { if(num[0]-(int)num[0]==0) { number[j]=numgen(num,i,dp); } else { number[j]=num[0]; } if(task=='+') { number[j]=add(number[j-1],number[j]); } else if(task=='-') { number[j]=sub(number[j-1],number[j]); } else if(task=='x') { number[j]=mul(number[j-1],number[j]); } else if(task=='/') { number[j]=divi(number[j-1],number[j]); } else if(task=='^') { number[j]=pow(number[j-1],number[j]); } j++; i=0; number[j]=0; dp=-1; task='-'; clearviewport(); delay(25); goto getclick; } else if(remark==15) { if(num[0]-(int)num[0]==0) { number[j]=numgen(num,i,dp); } else { number[j]=num[0]; } if(task=='+') { number[j]=add(number[j-1],number[j]); } else if(task=='-') { number[j]=sub(number[j-1],number[j]); } else if(task=='x') { number[j]=mul(number[j-1],number[j]); } else if(task=='/') { number[j]=divi(number[j-1],number[j]); } else if(task=='^') { number[j]=pow(number[j-1],number[j]); } j++; i=0; number[j]=0; dp=-1; num[i]=0; task='x'; clearviewport(); delay(25); goto getclick; } else if(remark==16) { if(num[0]-(int)num[0]==0) { number[j]=numgen(num,i,dp); } else { number[j]=num[0]; } if(task=='+') { number[j]=add(number[j-1],number[j]); } else if(task=='-') { number[j]=sub(number[j-1],number[j]); } else if(task=='x') { number[j]=mul(number[j-1],number[j]); } else if(task=='/') { number[j]=divi(number[j-1],number[j]); } else if(task=='^') { number[j]=pow(number[j-1],number[j]); } j++; i=0; number[j]=0; dp=-1; num[i]=0; task='/'; clearviewport(); delay(25); goto getclick; } else if(remark==-3) { number[j]=sqrt(number[j]); num[0]=number[j]; i=1; task='S'; ans=number[j]; clearviewport(); delay(50); clearmouseclick(513); goto getclick; } else if(remark==-4) { number[j]=(number[j]/100)*number[j-1]; if(number[j-1]==0) { number[j]=0; } num[0]=number[j]; i=1; task='S'; ans=number[j]; clearviewport(); delay(50); clearmouseclick(513); goto getclick; } else if(remark==-5) { if(num[0]-(int)num[0]==0) { number[j]=numgen(num,i,dp); } else { number[j]=num[0]; } if(task=='+') { number[j]=add(number[j-1],number[j]); } else if(task=='-') { number[j]=sub(number[j-1],number[j]); } else if(task=='x') { number[j]=mul(number[j-1],number[j]); } else if(task=='/') { number[j]=divi(number[j-1],number[j]); } else if(task=='^') { number[j]=pow(number[j-1],number[j]); } j++; i=0; number[j]=0; dp=-1; num[i]=0; task='^'; clearviewport(); delay(25); goto getclick; } else if(remark==-6) { number[j]=ans; num[0]=ans; i=1; clearviewport(); delay(25); goto getclick; } else { clearmouseclick(513); goto getclick; } } clearmouseclick(513); goto getclick; }
void design_cp2() { cp=2; srand((unsigned)time(NULL)); food.flag=1; mine.flag=1; direct=4; score=0; poigrass.cor[0].x=240; poigrass.cor[0].y=40; poigrass.cor[1].x=340; poigrass.cor[1].y=180; poigrass.cor[2].x=240; poigrass.cor[2].y=500; poigrass.cor[3].x=60; poigrass.cor[3].y=240; poigrass.cor[4].x=500; poigrass.cor[4].y=300; p0=(struct Snake*)malloc(LEN); head=(struct Snake*)malloc(LEN); tail=(struct Snake*)malloc(LEN); p1=(struct Snake*)malloc(LEN); head->x=2*20; head->y=5*20; tail->x=20; tail->y=5*20; p0=tail; map(); tail->x=head->x-20; tail->y=head->y; head->next=tail; head->previous=NULL; tail->next=NULL; tail->previous=head; tim1=(unsigned)time(NULL); while(1) { while(!kbhit()) { set_poigrass(); set_poigrass1(); if(food.flag==1) set_food(); if(mine.flag==1) set_mine(); show_food(); show_mine(); snake_move(); ju_eat_food(); if(node==16) { initgraph(500,400); setbkcolor(GREEN); cleardevice(); setcolor(RED); setfont(40,0,"华文行楷"); outtextxy(70,160,"恭喜你,进入下一关!"); Sleep(3000); design_cp3(); } ju_meet_mine(); ju_eat_poigrass(); while(p0->next!=NULL) { if((p0->next->x==head->x)&&(p0->next->y==head->y)) life=0; p0=p0->next; } if(life==0) gameover(); if(head->x>=680) { setfillcolor(YELLOW); setcolor(YELLOW); bar(tail->x-20,tail->y,tail->x,tail->y+20); gameover(); } if(head->x<20) { setfillcolor(YELLOW); setcolor(YELLOW); bar(tail->x+20,tail->y,tail->x+40,tail->y+20); gameover(); } if(head->y>=580) { setfillcolor(YELLOW); setcolor(YELLOW); bar(tail->x,tail->y-20,tail->x+20,tail->y); gameover(); } if(head->y<20) { setfillcolor(YELLOW); setcolor(YELLOW); bar(tail->x,tail->y+20,tail->x+20,tail->y+40); gameover(); } if(direct==4) if(head->x==200&&(head->y>=160&&head->y<=380)||head->x==420&&(head->y>=280&&head->y<=420)) { setfillcolor(YELLOW); setcolor(YELLOW); bar(tail->x-20,tail->y,tail->x,tail->y+20); gameover(); } if(direct==3) if(head->x==200&&(head->y>=160&&head->y<=380)||head->x==420&&(head->y>=280&&head->y<=420)) { setfillcolor(YELLOW); setcolor(YELLOW); bar(tail->x+20,tail->y,tail->x+40,tail->y+20); gameover(); } if(direct==1) if(head->x==200&&head->y==380||head->x==420&&head->y==420) { setfillcolor(YELLOW); setcolor(YELLOW); bar(tail->x,tail->y+20,tail->x+20,tail->y+40); gameover(); } if(direct==2) if(head->x==200&&head->y==160||head->x==420&&head->y==280) { setfillcolor(YELLOW); setcolor(YELLOW); bar(tail->x,tail->y-20,tail->x+20,tail->y); gameover(); } show_snake(); tim2=(unsigned)time(NULL); if(tim2-tim1>=50) no_poigrass(); } change(); } }
int click() { int x,y; x=mousex(); y=mousey(); if(x>=108&&x<=156&&y>=138&&y<=188) { clearmouseclick(513); return 9; } else if(x>=56&&x<=104&&y>=138&&y<=188) { clearmouseclick(513); return 8; } else if(x>=4&&x<=52&&y>=138&&y<=188) { clearmouseclick(513); return 7; } else if(x>=108&&x<=156&&y>=192&&y<=246) { clearmouseclick(513); return 6; } else if(x>=56&&x<=104&&y>=192&&y<=246) { clearmouseclick(513); return 5; } else if(x>=4&&x<=52&&y>=192&&y<=246) { clearmouseclick(513); return 4; } else if(x>=108&&x<=156&&y>=250&&y<=300) { clearmouseclick(513); return 3; } else if(x>=56&&x<=104&&y>=250&&y<=300) { clearmouseclick(513); return 2; } else if(x>=4&&x<=52&&y>=250&&y<=300) { clearmouseclick(513); return 1; } else if(x>=56&&x<=104&&y>=304&&y<=354) { clearmouseclick(513); return 0; } else if(x>=4&&x<=52&&y>=304&&y<=354) { clearmouseclick(513); return -2; } else if(x>=108&&x<=156&&y>=75&&y<=125) { clearmouseclick(513); return -3; } else if(x>=56&&x<=104&&y>=75&&y<=125) { clearmouseclick(513); return -4; } else if(x>=4&&x<=52&&y>=75&&y<=125) { clearmouseclick(513); return -5; } else if(x>=108&&x<=156&&y>=304&&y<=354) { clearmouseclick(513); return -6; } else if(x>=175&&x<=225&&y>=138&&y<=246) { clearmouseclick(513); return 11; } else if(x>=200&&x<=254&&y>=304&&y<=354) { clearmouseclick(513); return 12; } else if(x>=229&&x<=279&&y>=138&&y<=188) { clearmouseclick(513); return 13; } else if(x>=175&&x<=225&&y>=250&&y<=300) { clearmouseclick(513); return 14; } else if(x>=229&&x<=279&&y>=192&&y<=246) { clearmouseclick(513); return 15; } else if(x>=229&&x<=279&&y>=250&&y<=300) { clearmouseclick(513); return 16; } else if(x>=175&&x<=225&&y>=75&&y<=125) { clearmouseclick(513); return -1; } else if(x>=230&&x<=280&&y>=75&&y<=125) { clearmouseclick(513); return -100; } else if(x>=1&&x<=48&&y>=55&&y<=65) { cleardevice(); setviewport(0,0,300,370,1); setcolor(BLUE); settextstyle(8,0,1); outtextxy(10,10,"MD. NAHIDUL ISLAM OPU"); outtextxy(10,50,"*****@*****.**"); delay(2000); cleardevice(); clearviewport(); layout(); setviewport(3,8,290,50,1); return -1000; } clearmouseclick(513); return -1000; }
void show() { cleardevice(); setcolor(RED); rectangle(40,40,600,450); setcolor(RED); line(sa[0],sa[1],sa[2],sa[3]); rectangle(sa[0],sa[1],sa[2],sa[3]+5); setfillstyle(SOLID_FILL,RED); floodfill((sa[0]+sa[2])/2,(sa[1]+sa[3]+5)/2,RED); circle(sa1[0],sa1[1],r1); setfillstyle(SOLID_FILL,RED); floodfill(sa1[0]+1,sa1[1]+1,RED); setcolor(RED); for(i=0;i<30;i++) if(bool3[i]==1) { setcolor(rand()%5+1); circle(bool1[i],bool2[i],28); } for(i=0;i<kk;i++) {if(sin3[i]!=0) if(sin2[i]<=445) { sin2[i]=sin2[i]+5; circle(sin1[i],sin2[i],sin3[i]); switch(sin3[i]) {case 12:outtextxy(sin1[i]-5,sin2[i],"+1"); break; case 14:outtextxy(sin1[i]-5,sin2[i],"-1"); break; case 16:outtextxy(sin1[i]-5,sin2[i],"+"); break; case 18: outtextxy(sin1[i]-5,sin2[i],"-"); break; case 8:outtextxy(sin1[i]-5,sin2[i],"@"); break; case 10:outtextxy(sin1[i]-5,sin2[i],"*"); break; case 6:outtextxy(sin1[i]-2,sin2[i],"O"); break; case 4:outtextxy(sin1[i]-1,sin2[i],"o"); break; } if(sin1[i]>=sa[0]&&sin1[i]<=sa[2]) { if(sin2[i]+sin3[i]>=sa[1]) { switch(sin3[i]) {case 12:li=li+1;break; case 14:outtextxy(140,350,"LIFE LOSE"); li=li-1;score=score-50; delay(2000); if(li==0) {cleardevice(); outtextxy(140,380,"GAME OVER AND YOUR SCORE"); printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n %ld",score); delay(4000); fil(); } get(); break; case 16:r=r*2;score=score+100;break; case 18:r=r/2;break; case 8:mn=20;score=score+100;break; case 10:powe=powe*powe;score=score+100;break; case 6:r1=r1*2;score=score+100; break; case 4:r1=r1/2; break; } sin3[i]=0; }} } } }
void pass() { int i,k,a ; char masterlist[2][20]={ "Shubham Singh","Tejendra Singh"}; char yourname[20]; char password[20]; char ch; textcolor(RED); cleardevice(); setbkcolor(BLACK); settextstyle(11,0,5); setcolor(BLUE); setlinestyle(SOLID_LINE,1,2); rectangle(0,0,639,469); setcolor(3); rectangle(20,20,619,449); setcolor(RED); setlinestyle(DASHED_LINE,1,2); rectangle(10,10,629,459); setcolor(6); line(142,230,428,230); setcolor(YELLOW); rectangle(140,190,430,270); setcolor(2); line(300,190,300,270); setcolor(RED); outtextxy(150,205,"Enter the Username:"******"Enter the Password:"******"\b");i--;} else {password[i]=ch;printf("*");}} for(i=0;i<2;i++) { if((strcmp(&masterlist[i][0],password)==0)) { cleardevice(); settextstyle(5,0,6); setbkcolor(BLUE); setcolor(YELLOW); outtextxy(180,200,".....Welcome....."); gotoxy(40,18); puts(yourname); for(i=0;i<30;i++) { setlinestyle(DASHED_LINE,1,8); setcolor(i); rectangle(162,202,542,302); setcolor(i+1); rectangle(160,200,544,304); setcolor(i+2); rectangle(158,198,546,306); setcolor(i+3); rectangle(156,196,548,308); sound(600); delay(50); nosound(); delay(50); } cleardevice(); setbkcolor(YELLOW); settextstyle(11,0,4); setcolor(BROWN); outtextxy(10,10,"Use (left,right)arrow/(a,d) keys to move the tanker and uparrow/w key to fire Bullets"); setcolor(RED); settextstyle(4,0,4); outtextxy(220,200,"Please Wait"); outtextxy(250,300,"Loading....."); rectangle(98,438,502,462); setlinestyle(SOLID_FILL,1,2); setcolor(BLUE); for(i=100;i<=500;i+=2) { line(i,440,i,460); delay(20); } setcolor(RED); } else if(i==1) { cleardevice(); settextstyle(11,0,6); setbkcolor(RED); setcolor(YELLOW); outtextxy(200,250,"...Incorrect UserName/Password..."); outtextxy(227,280,"Access Denied"); outtextxy(227,290,"Sorry"); gotoxy(38,19); puts(yourname); for(i=1;i<4;i++) { sound(600); delay(1000); nosound(); delay(200); } exit(0); } } }