Monday, September 19, 2011

Analog Clock source code using c++ and winBGI graphics

This code does not run directly in code::blocks because winBGIm graphics is for turbo compiler where you can run this code directly and we don’t have to setup library but in code::block you have to setup.To setup WinBGIm graphics library you can see my previous post here .If you setup then now you are ready to compile this code.
Copy the code below and compile it in code::block.While compiling if you got error message in line 320 of graphics.h :” redefination of int right” then change int right=0 to int top = 0.Although,you got other error then leave the message.

How to setup winBGIm library in codeblock

BGI (Borland Graphics Interface) is ancient as is turbo c++ IDE but nevertheless they are still used in our schools and colleges. Plus they do not work in windows environment (support for native DOS has been completely removed in windows vista/7).If you try to compile the source code with including “graphics.h” in code::blocks IDE then is show error because “graphics.h” only run in turbo.For code::blocks you have to setup winBGIm library.
There are many alternative to winBGIm ,But BGI is good for beginners because you don’t have to worry about whole new fancy functions,classes etc.
WinBGIm is BGI graphics library ported to computer by by Michael Main at the University of Colorado.
Before i start, i must tell you that this guide is written in accordance with code::blocks IDE.

Lets get started:
  1. First download WinBGIm from http://winbgim.codecutter.org/
  2. Extract it.
  3. Copy graphics.h and winbgim.h files in include folder of your compiler directory
  4. Copy libbgi.a to lib folder of your compiler directory
  5. In code::blocks open Settings >> Compiler and debugger >>linker settings
  6. click Add button  in link libraries part and browse and select libbgi.a file
  7. In right part (ie. other linker options) paste commands
  8. -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
  9. click Ok
Finally, you can now compile source code using “graphics.h”.You can try this by creating "anlog clock" and you can copy source code from my post  here . The WinBGIm library gives you an alternative as I hope, you found this guide helpful and incase you need my help just leave a message.

Thursday, September 15, 2011

“Contacts Manager” mini project in C with source code

Contacts Manager is a simple mini project code in C.This is similar to contact manager in Mobile phones.You can add contacts,remove contacts,edit contacts,search contacts and view all contacts.Graphics is not used just a console application suitable for learning purpose for beginner and can be used as a reference for college mini project.In this project you learning file handling ,how to write data,delete data and search data form file.I hope my post may help you and you can send email for further help.
Copy the source code below or Download from GitHub and compile it in Code::Blocks.

Create a Matching Game using visual studio

In this tutorial, you build a matching game, where the player must match pairs of hidden icons. You learn how to:
  • Hold objects using a List object.
  • Use a foreach loop in Visual C# or a For Each loop in Visual Basic.
  • Keep track of a form's state using reference variables.
  • Build an event handler that you can use with multiple objects.
  • Make a timer fire exactly once when started.
Copy this code and create project on visual studio or Download complete project from GitHub.