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)
code to shut a computer with windows XPbenn mutisya 5.9 (10)
Tic-TacToeptrs 5.9 (10)
Short program to print Hello World! without semicolonAli Nawkhas Murad 5.9 (10)
this one is better because a potential overflow (of the + operation) is avoided 5.9 (10)
Create a new file under linuxChol Nhial 5.9 (10)
Eventhandling macro for classesToolsDevler 5.9 (10)
simple StopWatch with roundtrip timeNickMa 5.6 (9)
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)
Quick-sort using vector and iterator in STLJianbao Tao 5.6 (9)
Palindrome FunctionJason Weeks 5.6 (9)
String FunctionsDominic Vonk 5.6 (9)
String FunctionsDominic Vonk 5.6 (9)
Implementing a directory listing on LinuxJoshith C*nix6.3 (12)
GotoXYStack Overflow C*nix6.3 (339)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI6.9 (92)
useful macros, functions and tricksyzb3 CANSI6.1 (71)
Pascal's TriangleAli Nawkhas Murad C++ANSI6.7 (110)
An example of Exception HandlingAli Nawkhas Murad C++ANSI5.7 (66)
Word wrap functionSean Hubbard CANSI6.3 (85)
Simple linked list implementationyzb3 CANSI7.6 (68)
Examples of dynamic multidimensional arraysAli Nawkhas Murad C++ANSI6.6 (95)
Failproof xor (en/de)cryptionyzb3 CANSI6.7 (89)
xor (en/de)cryption using a key fileyzb3 CANSI6.2 (74)
Initial values for static multidimensional arrayAli Nawkhas Murad C or C++ANSI6.1 (76)
Find size and storage capacity of primitive data typesAli Nawkhas Murad C++ANSI6.2 (78)
Function pointer to member function of classselvam C++ANSI4.0 (39)
Next 30

Add a snippet!