C and C++ Programming Blog
RSS Feed

Quicksort in C Programming Language

Sunday, 16 March 2008 07:42
Quicksort is a well-known sorting algorithm developed by C.A.R. Hoare: Quicksort. Computer Journal, Vol. 5, 1, 10-15 (1962). Quicksort is said to be the fastest sorting algorithm in practice. On average it makes Θ(nlogn) (big O notation) comparisons to sort n items, but in the worst cases it isas slow as bubble sort. Visually you can see below that how quicksort works (divide and conquer strategy). More...

Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Top Programming tips for C and C++ Programmers

Saturday, 15 March 2008 07:38

Today I will discuss top coding tips which can be applied to any particular programming language. Also the tips will help you to write self documented programs which are easy to maintain and understand by anyone. 

Design first then code

Days are gone when we use to take pen and paper and write the pseudo code first draw the flow diagrams of the program. And at the end write the code on computer. Days are changed but still we need to apply SDLC (Software Development Life Cycle) on every program we create. This makes the program bug/error free as well as maintenance easy. I suggest you read Martin Fowler's excellent article Is Design Dead? which explains it in more details. More...

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Programming Mouse in C and C++

Monday, 18 February 2008 07:28

I was quite busy for the past few days in preparing some reports for my university, but was feeling a bit free today. I was thinking about what to write today. Having browsing throught the forums and few webpages I thought of writing about mouse programming in C and C++. I have written many programs, about programming mouse in C, before and explained the theory as well.

So what's today? Today I will provide some links about mouse programming and little description about those tutorials.More...

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

TrueCrypt Free Open Source Encryption Software

Sunday, 10 February 2008 07:23

TrueEncrypt is a free open Source Encryption Software written in C++ programming language. If you haven't used TrueCrypt before but need to protect confidential information and documents then I can totally propose to use this Free Software. The latest version has the ability to encrypt the whole drive on windows operating system. So without the password (which you set to encrypt the drive), you can not run your windows operating system.

This free open source software is available for windows including (XP and Vista). It is also available for Linux and Mac OS X. Currently the software uses three types of encryption techniques. They are Whirlpool, SHA-512, RIPEMD-160.

One of the features of the software is to encrypt/decrypt the files on the fly. It means that the software can encrypt or decrypt the files in real time. An example could be a video file or a program setup file. When user double clicks on the files to run it, it is decrypted at real time and the program is run from the RAM. I have never seen any software before. I would suggest you to read through the Documentation section before you download the free program.

Here are the links you would be interested in.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

C Language Graphics Library Reference (part 2)

Monday, 4 February 2008 07:10

In the previous post I discussed few important functions mostly used to initialize and destroy the graphics mode in DOS environment. Today I will discuss functions to draw diferent shapes and lines. So here we go by starting the line function which is most important function in creating any graphics.

Function line

This function draws a line in the graphics mode.

void far line(int startx, int starty, int endx, int endy)

Function arc

This function draws an arc from start to the end point. It uses the radius and the angle inputted in the function parametsr. Function prototye is

void far arc (int x, int y, int start, int end, int radius)

Function bar

The bar() functions draws a rectangular bar on the screen. It takes four parameters of type int which are infact the points on the graphics screen, and fills the bar with the defined fill-pattern. Function prototye is More...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Windows Sockets 2 Programming

Tuesday, 25 December 2007 00:41

Today we will discuss some important sockets functions which are almost used in any windows application which uses the sockets. These references are from the WinSock Version 2. So be sure to try them using the Version 2 or later.

Windows Sockets Reference - WinSock2

Function accept

Description: The accept function accepts an incoming request for connection attempt on a socket.

SOCKET accept(  
SOCKET s,  
struct sockaddr* addr,  
int* addrlen
);

Parameters:

s: This identifies a socket that is in a listening state with the listen function. The connection is actually made with the socket that is returned by accept. addr: Optional pointer to a buffer that receives the address of the connecting entity, as known to the communications layer. The exact format of the addr parameter is determined by the address family that was established when the socket from the SOCKADDR structure was created. addrlen: Its an parameter of type pointer to an integer that contains the length of addr.

If everything goes well then it returns the Socket, and if there is an error then INVALID_SOCKET value is returned. To get the specific error code you can call WSAGetLastError function to get the last error occured in sockets operation. More...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
 
Copyright © by MYCPLUS. All rights reserved. #