These are a few small programs that illustrate various issues for beginning programmers
|
|
| Example 1: This is the simplest program written in C++
Example1: This program calculates a price using if-else
Example 1: Passing arguments by value. |
Example 2: Different techniques of passing arguments: by value, by reference, or as pointers. |
Example 3: Program to calculate the Greatest Common Divisor |
Example 4: Another program that calculates the Greatest Common Divisor. |
Objects: Structures - Classes - Unions |
|
Example 1: A simple class in various files |
Example 2: This class creates a rectangular box and uses a constructor to initialize the
dimensions |
Example 3: An object as a function argument |
Example 4: An object declared as an array |
Example 5: An object as a member variable of another object. |
Example 6: This example uses anonymous Objects, that is, objects that don't have a name |
Example 7: This example shows to nest an object in another's body |
Example 1: This example shows how to enter strings that are terminated only with the
Carriage Return, allowing the user to enter a home address or a city name made of different worlds |
Example 1: This illustrates a simple inheritance exercise using a sphere derived from a circle |
|
Example 1: A list of regular C++ items such as integers, doubles, char, long, etc |
|