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 6.4 (14)
Tic-TacToeptrs 6.4 (14)
Short program to print Hello World! without semicolonAli Nawkhas Murad 6.4 (14)
this one is better because a potential overflow (of the + operation) is avoided 6.4 (14)
Create a new file under linuxChol Nhial 6.4 (14)
Eventhandling macro for classesToolsDevler 6.4 (14)
simple StopWatch with roundtrip timeNickMa 6.2 (13)
Integer Partitions from 1 to NChristopher Brown 6.4 (14)
Without semicolon print the statement.Jeevanrao 6.4 (14)
Without semicolon print the statement.Jeevanrao 6.4 (14)
Menu driven program in c programmingcampus 6.4 (14)
Output console text with type-writer effect.Michael Brandon Miller 6.4 (14)
Quick-sort using vector and iterator in STLJianbao Tao 6.2 (13)
Palindrome FunctionJason Weeks 6.2 (13)
String FunctionsDominic Vonk 6.2 (13)
String FunctionsDominic Vonk 6.2 (13)
Implementing a directory listing on LinuxJoshith C*nix2.8 (36)
GotoXYStack Overflow C*nix5.7 (389)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI5.7 (116)
useful macros, functions and tricksyzb3 CANSI4.8 (95)
Pascal's TriangleAli Nawkhas Murad C++ANSI5.1 (163)
An example of Exception HandlingAli Nawkhas Murad C++ANSI4.5 (90)
Word wrap functionSean Hubbard CANSI5.3 (111)
Simple linked list implementationyzb3 CANSI4.9 (117)
Examples of dynamic multidimensional arraysAli Nawkhas Murad C++ANSI5.5 (120)
Failproof xor (en/de)cryptionyzb3 CANSI5.5 (113)
xor (en/de)cryption using a key fileyzb3 CANSI4.9 (98)
Initial values for static multidimensional arrayAli Nawkhas Murad C or C++ANSI4.9 (100)
Find size and storage capacity of primitive data typesAli Nawkhas Murad C++ANSI5.0 (103)
Function pointer to member function of classselvam C++ANSI4.0 (39)
Next 30

Add a snippet!