Need help with Cpp-Tutorial-Samples?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

254 Stars 167 Forks 31 Commits 6 Opened issues


C++ tutorial code samples for those who want to start learning the language

Services available


Need anything else?

Contributors list

# 216,119
31 commits

C++ Tutorial Samples

This repository contains C++ sample codes that I adopted from various sources to help instruct programming in C++ in 2005. These samples try to help newcomers quickly find an appropriate pattern for solving their programming problems. Also they can quickly find out how a certain language construct, or a popular function is generally used.

These samples are by no means complete, nor free from deficiencies. Feel free to make them complete or introduce them to more C++ newbies or teachers. The samples cover only the standard/ISO C++ language.

To access or contribute the most recent modifications of these samples, find their github repository here:

Running the Samples

Each sample has a separate folder of its own, and is usually in a file named

. If you want to build a sample with Microsoft Visual Studio, then you need to create a project and copy the sample into that project by your own.

However there's a

in each directory, which makes the process of building and running the samples easier in Linux/Unix and Cygwin. In order to build each sample, simply
to its directory and run
to build the required executable. Run
make clean
to clean-up your directory. Also
make full
, first cleans and then rebuilds each sample.


Beside several Internet sources, the following are the main references that I used during the course of creating these samples. Most of the samples are adopted from the first reference. Even many of the comments are quoted from it. I strongly recommend studying the first reference, if you are learning C++ as a first programming language.

[1] H. Deitel and P. Deitel, C++ How to Program, 5th ed. Prentice Hall, Jan. 2005.

[2] B. Stroustrup, The C++ Programming Language, 3rd ed. Addison-Wesley Professional, Jun. 1997.

[3] H. Schildt, C++: The Complete Reference, 4th ed. McGraw-Hill Osborne Media, Nov. 2002.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.