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)
A portable card deck class with shufflingSlyMaelstrom C++ANSI8.8 (261)
Integer Partitions from 1 to NChristopher Brown 8.6 (308)
Without semicolon print the statement.Jeevanrao 8.6 (308)
Without semicolon print the statement.Jeevanrao 8.6 (308)
Menu driven program in c programmingcampus 8.6 (308)
Eventhandling macro for classesToolsDevler 8.6 (308)
Short program to print Hello World! without semicolonAli Nawkhas Murad 8.6 (308)
this one is better because a potential overflow (of the + operation) is avoided 8.6 (308)
Tic-TacToeptrs 8.6 (308)
Create a new file under linuxChol Nhial 8.6 (308)
Output console text with type-writer effect.Michael Brandon Miller 8.6 (308)
code to shut a computer with windows XPbenn mutisya 8.6 (308)
Quick-sort using vector and iterator in STLJianbao Tao 8.6 (307)
simple StopWatch with roundtrip timeNickMa 8.6 (307)
Palindrome FunctionJason Weeks 8.6 (307)
String FunctionsDominic Vonk 8.6 (307)
String FunctionsDominic Vonk 8.6 (307)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI8.2 (313)
This is Trigonometry Table made AlhamdulillahAbdul Haseeb Mir CWindows8.1 (263)
friend function exampleAli Nawkhas Murad C++ANSI8.0 (302)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI7.9 (344)
Templated stack class Ali Nawkhas Murad C++ANSI7.8 (335)
The standard ASCII table generator.Ali Nawkhas Murad C++ANSI7.8 (328)
ASCII table generatorAbdul Haseeb Mir C++ANSI7.7 (340)
An example of simple stack using linked lists.Ali Nawkhas Murad C++ANSI7.7 (344)
Pascal's TriangleAli Nawkhas Murad C++ANSI7.4 (395)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI7.4 (377)
Singly linked list - insert, remove, add, countGirish Amara CANSI7.3 (1084)
A code template for OpenGL / GLUTPerspective C or C++ANSI7.2 (488)
Knuth-Morris-Pratt (KMP) String Search AlgorithmSyed Rafey Husain C or C++ANSI7.0 (748)
Next 30

Add a snippet!