Technology News, Micromax, Mobiles Flashing Software, Flash Tool, Pokemon GO Apk, Income Online, Moto G4 Plus, Sony PC, Latest Version, samsung note, Huawei Smartphone

Monday, May 20, 2013

HOW TO SIMULATE A BOUNCING BALL USING C++

HOW TO SIMULATE A BOUNCING BALL USING C++ - technology is getting more advanced every day .. if you want to know the progress that happened please visit this blog Technology News because it will always update the latest information, now we will discuss first about HOW TO SIMULATE A BOUNCING BALL USING C++ hopefully this information can answer the questions you submit to google, ok please see:

Articles : HOW TO SIMULATE A BOUNCING BALL USING C++
full Link : HOW TO SIMULATE A BOUNCING BALL USING C++
Article C++, Article How to, Article programming,

You can also see our article on:


HOW TO SIMULATE A BOUNCING BALL USING C++

HEllo!!
Bouncing ball simulation is really interesting in C++. It uses the header file <graphics.h> for drawing the ball, and here we also use http://micromyaw.blogspot.com /2013/05/using-delay-function-in-c.html">the delay function for displaying the ball in different places.
The header files used : < graphics.h> , <stdio.h>, <conio.h> , <iostream.h>, <dos.h>, <stdlib.h>
the source code is not that hard to understand if you know how to use graphics in C++.
Otherwise it's a little complicated, again 'copy-paste'.


here is the source code:

#include<stdio.h>
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
int n = 200,x = 50, y = 50, r=30;
void move()
{
setcolor(GREEN);
circle(x,y,r);
delay(70);
setcolor(BLACK);
setfillstyle(1,BLACK);
circle(x,y,r);
floodfill(x,y,BLACK);
delay(50);
putpixel(x,y,8);
return;
}
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\tc\BGI");
while(n>0)
{
while(y<450)
{
move();
y = y+25;
x=x+5;
putpixel(x,y,8);
} while (y>n)
{ move();
y=y-25;
x=x+5;
putpixel(x,y,8);
} n=n+50;
}setcolor(GREEN);
circle(x,y,r);
getch();
closegraph();
}
view raw gistfile1.cpp hosted with ❤ by GitHub


That's it, there is nothing you can do in this simulator, other than watching it bounce.

Thank you
cheers !!
keep coding..





information about HOW TO SIMULATE A BOUNCING BALL USING C++ has been completed in the discussion

hopefully information HOW TO SIMULATE A BOUNCING BALL USING C++ can benefit you in getting the latest information about technology,

you just read the article entitled HOW TO SIMULATE A BOUNCING BALL USING C++ if the article feel useful for you please bookmark or share by using link https://micromyaw.blogspot.com/2013/05/how-to-simulate-bouncing-ball-using-c.html and thank you.

Tag : , , ,
Share on Facebook
Share on Twitter
Share on Google+

Related : HOW TO SIMULATE A BOUNCING BALL USING C++

  • Professional C# 2008 Professional C# 2008 If we were to describe the C# language and its associated environment, the .NET Framework, as the most important new technology for developers ...
  • C# Program which calculated factorial to prime functionC# Program which calculated factorial to prime functionProgram Statement:Write two functions max(int,int) and prime(int). max function will take two arguments and w ...
  • C# Program to Print Fibonacci seriesC# Program to Print Fibonacci seriesProgram Statement:Write a program which prints the Fibonacci series using loop.1 1 2 3 5 8 13 21 34 …Solution: public class _fib { ...
  • HOW TO USE THE DELAY FUNCTION IN C++Hello programmers!!Have you ever wondered how people use that effect, in C++ console applications, in which they make characters appear after a certain time. Like t ...
  • TARA Anti-Theft App For AndroidTARA mobile app is becoming popular in the Philippines due to exposure at the biggest TV News like GMA7, ABS-CBN and TV5. What captures their interest to feature this ap ...

0 comments:

Post a Comment