Professional Documents
Culture Documents
Linked are four C++ programs that illustrate some of the major features of the language. For
more information on many of these language features, see my C++ Quick Reference Page.
Some of these examples use function prototypes and put function definitions after main(). An
alternate approach is to skip the function prototyhpes and put function definitions before main().
The prototype approach scales up better, while the functions before main() approach is more
convenient for small programs.
sum.cpp swap.cpp
stdlib.cpp arrays.cpp
strings.cpp complex.cpp
comments.cpp cppstrings.html
cstrings.cpp cstrings2.cpp
stlstrings.cpp stlstrings2.cpp
stringswitch.cpp polytropic.cpp
formatedio.cpp rectangle.cpp
Creation of strings.
Concatenation of strings.
Use of the .insert, .find, .length and .substr string class member functions.
The program comments.cpp reads text from the file sometext.txt and illustrates:
The web page cppstrings.html discusses various ways in which to handle textual data in modern
C++.
The program polytropic.cppreads data from the file ideal.dat and illustrates:
Among the "advanced" C++ topics not covered in these examples are:
Send comments and suggestions about these examples to: Charles S. Tritt, Ph.D.
This page last updated 9/26/99