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 8.1 (424)
Tic-TacToeptrs 8.1 (424)
Short program to print Hello World! without semicolonAli Nawkhas Murad 8.1 (424)
this one is better because a potential overflow (of the + operation) is avoided 8.1 (424)
Create a new file under linuxChol Nhial 8.1 (424)
Eventhandling macro for classesToolsDevler 8.1 (424)
simple StopWatch with roundtrip timeNickMa 8.1 (423)
Integer Partitions from 1 to NChristopher Brown 8.1 (424)
Without semicolon print the statement.Jeevanrao 8.1 (424)
Without semicolon print the statement.Jeevanrao 8.1 (424)
Menu driven program in c programmingcampus 8.1 (424)
Output console text with type-writer effect.Michael Brandon Miller 8.1 (424)
Quick-sort using vector and iterator in STLJianbao Tao 8.1 (423)
Palindrome FunctionJason Weeks 8.1 (423)
String FunctionsDominic Vonk 8.1 (423)
String FunctionsDominic Vonk 8.1 (423)
Implementing a directory listing on LinuxJoshith C*nix2.9 (37)
GotoXYStack Overflow C*nix5.8 (405)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI7.1 (402)
useful macros, functions and tricksyzb3 CANSI5.1 (101)
Pascal's TriangleAli Nawkhas Murad C++ANSI6.7 (459)
An example of Exception HandlingAli Nawkhas Murad C++ANSI4.6 (92)
Word wrap functionSean Hubbard CANSI5.5 (121)
Simple linked list implementationyzb3 CANSI5.1 (125)
Examples of dynamic multidimensional arraysAli Nawkhas Murad C++ANSI5.6 (124)
Failproof xor (en/de)cryptionyzb3 CANSI5.5 (118)
xor (en/de)cryption using a key fileyzb3 CANSI5.1 (104)
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.2 (109)
Function pointer to member function of classselvam C++ANSI4.0 (39)
Next 30

Add a snippet!