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)
An example of simple stack using linked lists.Ali Murad C++ANSI8.3 (44)
ASCII table generatorAbdul Haseeb Mir C++ANSI8.7 (27)
Conversions between number systemsAli Murad C++ANSI8.6 (42)
Simple example for using thousand separator (,)Ali Murad C++ANSI8.7 (32)
binary addition using stack in STLanmol C++ANSI8.8 (37)
Distanceprog-bman C++ANSI5.5 (184)
A simple example of hashtableAli Murad C++ANSI8.3 (52)
Template Calculatorprog-bman C++ANSI6.1 (274)
An example of simple priority queue using linked lists.Ali Murad C++ANSI8.4 (45)
Three Dimension Coordinate Systems ConverterAli Murad C++ANSI8.9 (22)
Templated stack class Ali Murad C++ANSI8.7 (46)
Permutation GeneratorTreenef C++ANSI7.4 (322)
Print variables with file and line number for debuggingmike lear C++ANSI6.2 (10)
View the contents of a directoryfinnepower C++Windows6.9 (159)
Color header for Windows that integrates with coutSang-drax C++Windows6.3 (206)
Simple Windows Socket Server ExampleJahan Addison C++Windows6.5 (29)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI7.9 (40)
Calculates 1 variable statisticsPaul Kennedy C++ANSI5.3 (8)
An example use of a function pointerJayesh C++ANSI6.8 (12)
Calandar generator printing a full calendar for any yearJoe C++ANSI6.7 (20)
Templated queue classAli Murad C++ANSI8.6 (53)
An example of Exception HandlingAli Murad C++ANSI8.9 (37)
Examples of dynamic multidimensional arraysAli Murad C++ANSI8.8 (53)
View the format of IEEE 754 floating point numbersAli Murad C++ANSI9.0 (50)
Find size and storage capacity of primitive data typesAli Murad C++ANSI8.6 (47)
Function pointer to member function of classselvam C++ANSI7.6 (5)
An example of using the same variable name in different scopesAli Murad C++ANSI8.7 (50)
Integer subset generatortreenef C++ANSI5.3 (10)
Example of polymorphismAli Murad C++ANSI8.6 (55)
A portable card deck class with shufflingSlyMaelstrom C++ANSI5.0 (8)
Next 30
Previous 30

Add a snippet!