This is a bouncing ball made from C language

Ticker

10/recent/ticker-posts

This is a bouncing ball made from C language


Attractive Bouncing Ball


 #include <stdio.h>

#include <conio.h>
#include <graphics.h>
#include <dos.h>
 
int main()
{
 int gd = DETECT, gm;
 int i, x, y, flag=0;
 initgraph(&gd, &gm, " ");
 
 x = getmaxx()/2;
 y = 30;
 
 
 while (!kbhit())
{
  if(y >= getmaxy()-30 || y <= 30)
     flag = !flag;
    
     setcolor(LIGHTGREEN);
     setfillstyle(SOLID_FILL, LIGHTGREEN);
     circle(x, y, 60);
     floodfill(x, y, LIGHTGREEN);
 
 delay(50);

 cleardevice();
 if(flag)
{
     y = y + 5;
 }
else
{
     y = y - 5;
 }
 }
 
    getch();
    closegraph();
    return 0;
}

OUTPUT




Post a Comment

23 Comments

  1. Wow this is a bouncing ball Waten interesting 😘😘😘

    ReplyDelete
  2. excellent excellent excellent excellent excellent excellent excellent excellent excellent excellent excellent excellent excellent excellent

    ReplyDelete