hob50x50.gif (1121 bytes)

C++ Materials

Math Algorithms written in C++.

Here are some math algorithm programs, such as InFix to PostFix notation change, GCD,
standard normal CDF (x), Richardson Extrapolation- and Romberg's Integration algorithms.

Math Algorithms.

Pattern Matching Algorithms written in C++.

This program implements both the 'brute-force' and 'Boyer-Moore' algorithms to search for a pattern
in a text.  It searches both a low cardinality alphabet (a and b pattern) text, and English text.

Click here if you would like obtain the source for this program.

You will also need the pattern and text files.

Graph and Shortest Path Algorithms written in C++.

maze.gif (47054 bytes)

A program that takes the input of a maze in a directed graph form.
The output is a set of vertices from the beginning of the maze to the end and it must be the shortest path.


I'm providing a visual maze, so you can figure out what the output should be,
but the program will take a text input file. The input file has the following format.
Each line is a vertex. The first number is a vertex number,
any number that following are vertices that this one connects to.
It is possible that a vertex doesn't connect to any vertices.
A -1 marks the end of a vertex.

1 2 3 -1 // so v1 connects to v2 and v3
2 -1      // doesn't connect to any other vertex.

Click here if you would like obtain the source for this program.

You will also need the input-file.

Dining Philosophers Problem Algorithms written in C.

This program implements Dining Philosophers Problem.  It has two versions,
both a Deadlock and a Deadlock free version.  The Deadlock free version
uses a safety algorithm to check that it is safe to allocate any resources
before they are allocated.  It is written for a LINUX system.

1) Compile the code with a C-compiler, I had trouble using the g++ compiler.

gcc -o semrm semrm.c -pthread
gcc -o diningp1 diningp1.c -pthread
gcc -o diningp2 diningp2.c -pthread

2) Run diningp1 (deadlock) or diningp2 (deadlock free) to simulate
dining philosopher problem. Both programs accept one command line
argument of integer type, this integer is used to create certain number of

./diningp1 10
./diningp2 10 (0 < int < 21)

3) After we finished with a simulation, we have to run semrm program
to remove the array of semaphores previously allocated.


Click here if you would like obtain the source for this program.

Links to other good to have web sites:

Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based compiler.

TextPad® is a simple to use text editor. Whether you simply need a powerful replacement for Notepad, a tool for editing your web pages, or a programming IDE, TextPad does what you want, the way you would expect.

logo.jpg (4958 bytes)

mainlogo.gif (2170 bytes)

Here is the latest draft of the "Available C++ libraries FAQ". This list is not exhaustive. If you are looking for a particular library, and you don't find it here, try an ordinary Web search engine.

cplusplus.com is an open resource for visitors. Here you will find Technical documents covering the different facets of the C++ language, from getting started tutorials to specific documents about hardware, operating systems, internet, etc.

trump.gif (1498 bytes)

head01.gif (10569 bytes)

This page created by:

email.gif (28270 bytes)   Christer Karlsson