dev c++

Lately I have been searching  this post on the net about graphics.h in dev c++ and found few resources about it .  So I decided to write how to use graphics.h in dev-c++.  I am expecting that you have already installed bloodshed dev-cpp on your machine.  Graphics.h is a header file found in borlan c but because of its late development devcpp is now the mostly used IDE and compiler in programming c++.

Below are the steps on how to get graphics.h running on your machine,

  1. download graphics.h and save it to the include folder where you installed dev-cpp (C:\Dev-Cpp\include)
  2. Download libbgi.a and save it in the lib folder where you installed dev-cpp (C:\Dev-Cpp\lib)
  3. So when you have to create a program that needs the use of graphics.h  you must instruct the linker to link in certain libraries by going to projects > project options > parameters tab > linker column copy the lines below and paste it on that column.

By then you should be able to use graphics.h. As a sample I created this bubble sort algorithm as an example on how to use graphics.h in c++.

The program will have scattered points on the screen and will form a line as the loop iterates and at the end it will display how many loops are needed to sort the randomly generated numbers.

If you have problems using the functions you can refer to this link.  I hope this helps in solving your problem about dev c++ graphics.h with the bubble sort algorithm.

    Reference:

  • http://www.cs.colorado.edu/~main/bgi/dev-c++/ – dev C installation and how to add the libraries
  • http://www.cs.colorado.edu/~main/bgi/doc/ – libgi documentation