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++ANSI9.6 (4665)
Menu driven program in c programmingcampus 7.4 (518)
Palindrome FunctionJason Weeks 7.4 (496)
Create a new file under linuxChol Nhial 7.4 (497)
Integer Partitions from 1 to NChristopher Brown 7.4 (497)
Tic-TacToeptrs 7.4 (495)
Eventhandling macro for classesToolsDevler 7.4 (494)
String FunctionsDominic Vonk 7.4 (493)
Quick-sort using vector and iterator in STLJianbao Tao 7.4 (493)
simple StopWatch with roundtrip timeNickMa 7.4 (495)
Output console text with type-writer effect.Michael Brandon Miller 7.4 (495)
Singly linked list - insert, remove, add, countGirish Amara CANSI7.2 (1973)
A portable card deck class with shufflingSlyMaelstrom C++ANSI6.8 (395)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI6.6 (449)
Knuth-Morris-Pratt (KMP) String Search AlgorithmSyed Rafey Husain C or C++ANSI6.6 (868)
friend function exampleAli Nawkhas Murad C++ANSI6.5 (435)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI6.5 (466)
ASCII table generatorAbdul Haseeb Mir C++ANSI6.5 (493)
An example of simple stack using linked lists.Ali Nawkhas Murad C++ANSI6.4 (477)
A code template for OpenGL / GLUTPerspective C or C++ANSI6.4 (636)
The standard ASCII table generator.Ali Nawkhas Murad C++ANSI6.4 (452)
This is Trigonometry Table made AlhamdulillahAbdul Haseeb Mir CWindows6.4 (390)
Pascal's TriangleAli Nawkhas Murad C++ANSI6.3 (529)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI6.3 (511)
Calandar generator printing a full calendar for any yearJoe C++ANSI6.0 (275)
a simple clockrichmond caesar CANSI5.9 (745)
Converts a real number to the string.Darko Kolakoviћ C or C++ANSI5.7 (248)
Checking for powers of twoWebmaster C or C++ANSI5.7 (329)
Examples of dynamic multidimensional arraysAli Nawkhas Murad C++ANSI5.7 (131)
Useful string functionsyzb3 CANSI5.7 (152)
Next 30

Add a snippet!