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.7 (6)
Tic-TacToeptrs 5.7 (6)
Short program to print Hello World! without semicolonAli Nawkhas Murad 5.7 (6)
this one is better because a potential overflow (of the + operation) is avoided 5.7 (6)
Create a new file under linuxChol Nhial 5.7 (6)
Eventhandling macro for classesToolsDevler 5.7 (6)
simple StopWatch with roundtrip timeNickMa 5.0 (5)
Integer Partitions from 1 to NChristopher Brown 5.7 (6)
Without semicolon print the statement.Jeevanrao 5.7 (6)
Without semicolon print the statement.Jeevanrao 5.7 (6)
Menu driven program in c programmingcampus 5.7 (6)
Output console text with type-writer effect.Michael Brandon Miller 5.7 (6)
Quick-sort using vector and iterator in STLJianbao Tao 5.0 (5)
Palindrome FunctionJason Weeks 5.0 (5)
String FunctionsDominic Vonk 5.0 (5)
String FunctionsDominic Vonk 5.0 (5)
Implementing a directory listing on LinuxJoshith C*nix6.3 (12)
GotoXYStack Overflow C*nix6.3 (338)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI9.0 (63)
useful macros, functions and tricksyzb3 CANSI8.7 (45)
Pascal's TriangleAli Nawkhas Murad C++ANSI8.4 (82)
An example of Exception HandlingAli Nawkhas Murad C++ANSI8.6 (41)
Word wrap functionSean Hubbard CANSI8.4 (60)
Simple linked list implementationyzb3 CANSI7.7 (60)
Examples of dynamic multidimensional arraysAli Nawkhas Murad C++ANSI8.7 (63)
Failproof xor (en/de)cryptionyzb3 CANSI8.9 (62)
xor (en/de)cryption using a key fileyzb3 CANSI8.8 (47)
Initial values for static multidimensional arrayAli Nawkhas Murad C or C++ANSI8.4 (52)
Find size and storage capacity of primitive data typesAli Nawkhas Murad C++ANSI8.4 (54)
Function pointer to member function of classselvam C++ANSI8.6 (11)
Next 30

Add a snippet!