C Program

0 comments
Bouncing Ball

#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <dos.h>


  int main() 

{
        
        int gdriver = DETECT, gmode, err;
        int i = 0, x = 0, y = 0, flag = 0;

       
        initgraph(&gdriver, &gmode, "C:/TURBOC3/BGI");
        err = graphresult();

        if (err != grOk) {
               
                printf("Graphics Error: %s\n",
                                grapherrormsg(err));
                return 0;
        }

        
        while (x <= getmaxx() && !kbhit()) {

               
                setcolor(LIGHTRED);
                
                setfillstyle(SOLID_FILL, LIGHTRED);

                
                pieslice(x, y, 0, 360, 12);

               
                if (i % 5 == 0) {
                        
                        x = x + 3;
                        i = 0;
                }


                
                if (flag) {
                        
                        y = y - 10;
                } else {
                     
                        y = y + 10;
                }

                
                if (y >= getmaxy()) {
                        flag = 1;
                } else if (y <= 0) {
                        flag = 0;
                }

               
                delay(50);
              
                cleardevice();
                i++;
        }

        getch();

      
        closegraph();

        return 0;

  }

______________________________________________________________

Vista Wellcome Screen Loading


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>

            void main (void)
   clrscr();
 int gd= DETECT,gm;
initgraph(&gd,&gm,"C:\\BGI");
int x=getmaxx()/2,y=getmaxy()/2;
setcolor(GREEN);
rectangle(x-120,y+220,x+120,y-110);

setbkcolor(BLACK);
rectangle(x-110,y+200,x+110,y+180);
setcolor(YELLOW);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
outtextxy(x-60,y+85 ,"Windows ");
settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
outtextxy(x+60,y+132 ,"TM ");
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,6);
outtextxy(x-55,y+110 ,"Vista");
circle(x,y,70);
setcolor(RED);
rectangle(x-35,y-35,x-5,y-5);
rectangle(x+35,y-35,x+5,y-5);
rectangle(x-35,y+35,x-5,y+5);
rectangle(x+35,y+35,x+5,y+5);
int startx;
x: startx=x-110;
while(startx<x+108)
{
setfillstyle(SOLID_FILL,GREEN);
bar(startx+2,y+200,startx+5,y+180);
delay(50);
startx+=6;
if(kbhit())
goto y;
}

setfillstyle(SOLID_FILL,BLACK );
bar(x-110,y+200,x+112,y+180);
delay(1000);
goto x;
y:getch();



}






 
Copyright 2009 Fawad Khan
BloggerTheme by BloggerThemes | Design by 9thsphere