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)
Short program to print Hello World! without semicolonAli Nawkhas Murad 5.9 (10)
code to shut a computer with windows XPbenn mutisya 5.9 (10)
Eventhandling macro for classesToolsDevler 5.9 (10)
Integer Partitions from 1 to NChristopher Brown 5.9 (10)
Without semicolon print the statement.Jeevanrao 5.9 (10)
Without semicolon print the statement.Jeevanrao 5.9 (10)
Menu driven program in c programmingcampus 5.9 (10)
Output console text with type-writer effect.Michael Brandon Miller 5.9 (10)
ASCII table generatorAbdul Haseeb Mir C++ANSI5.9 (79)
Simple linked list implementationyzb3 CANSI5.9 (93)
euler approximation methoderic mbakop C or C++ANSI5.9 (256)
Simple example for using thousand separator (,)Ali Nawkhas Murad C++ANSI5.9 (63)
One line swap of integersabhilash C or C++ANSI5.9 (161)
A game setup for DirectXPaul D C or C++ANSI5.8 (255)
Simple Windows Socket Server ExampleJahan Addison C++Windows5.8 (95)
Color header for Windows that integrates with coutSang-drax C++Windows5.8 (231)
GetLastError error lookup toolKen Fitlike CWindows5.8 (185)
This C code recursively sorts an array of upto 20Abhishek H.Dwivedi C or C++ANSI5.8 (211)
Calculates 1 variable statisticsPaul Kennedy C++ANSI5.8 (9)
similar to gotoxy; minimal screen control for wyseMike Kinney C or C++ANSI5.8 (156)
A very simple frames per second functionJeff Verkoeyen C or C++Windows5.8 (197)
Pascal's TriangleAli Nawkhas Murad C++ANSI5.8 (139)
An example of Exception HandlingAli Nawkhas Murad C++ANSI5.7 (66)
Calculates the closest point to a segmentAdrián Deccico C or C++ANSI5.7 (133)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI5.7 (116)
Simple swapping heapsortyzb3 C or C++ANSI5.7 (124)
Converts a real number to the string.Darko Kolakoviћ C or C++ANSI5.6 (238)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI5.6 (74)
Quick-sort using vector and iterator in STLJianbao Tao 5.6 (9)
Palindrome FunctionJason Weeks 5.6 (9)
Next 30
Previous 30

Add a snippet!