Friday, August 24, 2012

Square In C Graphics

, , , No comments

Source Code

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

int main()
  {
     int gd = DETECT ,gm,j=0,a,b,p,q,r,s;
     initgraph(&gd,&gm,"c:/tc/bgi");


     
     a = getmaxx()/2;
     b = getmaxy()/2;
     p = a-10;
     q = b-10;
     r = a+10;
     s = b+10;
     
     while(!kbhit())
       {
          setcolor(j);
          rectangle(p,q,r,s);
          p=p-10;
          q=q-10;
          r=r+10;
          s=s+10;
          j++;        
          delay(500);
       } 
       
      getch();
      closegraph();
      return 0;     
  }

OUTPUT


  

0 comments:

Post a Comment

Entries RSS Comments RSS

Sample Text

Pages


Copyright © Lovely Codes
Powered by Blogger
Distributed By Free Blogger Templates | Design by N.Design Studio
Blogger Theme by Lasantha - PremiumBloggerTemplates.com