C and C++ Source Code Snippets

Welcome to Cprogramming.com's programming code snippet repository. Peruse the archives or add your own snippets for others to use! (Check the following link a better definition of a snippet)

Sort by clicking on any of the headers.

SnippetAuthorLanguagePlatformRating (votes)
Templated stack class Ali Nawkhas Murad C++ANSI8.5 (780)
Eventhandling macro for classesToolsDevler 8.1 (441)
Create a new file under linuxChol Nhial 8.1 (441)
Tic-TacToeptrs 8.1 (441)
Integer Partitions from 1 to NChristopher Brown 8.1 (441)
Output console text with type-writer effect.Michael Brandon Miller 8.1 (441)
simple StopWatch with roundtrip timeNickMa 8.1 (440)
Palindrome FunctionJason Weeks 8.1 (440)
Quick-sort using vector and iterator in STLJianbao Tao 8.1 (440)
String FunctionsDominic Vonk 8.1 (440)
Menu driven program in c programmingcampus 8.1 (444)
A portable card deck class with shufflingSlyMaelstrom C++ANSI7.6 (343)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI7.3 (396)
Singly linked list - insert, remove, add, countGirish Amara CANSI7.3 (1729)
friend function exampleAli Nawkhas Murad C++ANSI7.2 (380)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI7.2 (417)
This is Trigonometry Table made AlhamdulillahAbdul Haseeb Mir CWindows7.1 (336)
ASCII table generatorAbdul Haseeb Mir C++ANSI7.1 (433)
Calandar generator printing a full calendar for any yearJoe C++ANSI7.1 (208)
The standard ASCII table generator.Ali Nawkhas Murad C++ANSI7.0 (398)
An example of simple stack using linked lists.Ali Nawkhas Murad C++ANSI7.0 (423)
Knuth-Morris-Pratt (KMP) String Search AlgorithmSyed Rafey Husain C or C++ANSI6.9 (815)
A code template for OpenGL / GLUTPerspective C or C++ANSI6.8 (578)
Pascal's TriangleAli Nawkhas Murad C++ANSI6.8 (474)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI6.8 (456)
Simple integer binary search example source codeSyed Rafey Husain C or C++ANSI6.4 (8)
binary tree creation, traversal and searchSyed Rafey Husain C or C++ANSI6.3 (129)
Word wrap functionSean Hubbard CANSI5.9 (137)
GotoXYStack Overflow C*nix5.9 (420)
Simple swapping heapsortyzb3 C or C++ANSI5.9 (136)
Next 30

Add a snippet!