Example of a C++ program

The following example shows a z/OS® XL C++ program that prompts you to enter a birth date. The program output is the corresponding biorhythm chart.

The program is written using an object-oriented method. A class that is called BioRhythm is defined. It contains an object birthDate of class BirthDate, which is derived from the class Date. An object that is called bio of the class BioRhythm is declared.

The example contains two files. File CCNUBRH contains the classes that are used in the main program. File CCNUBRC contains the remaining source code. The example files CCNUBRC and CCNUBRH are shipped with the z/OS XL C++ compiler in data sets CBC.SCCNSAM(CCNUBRC) and CBC.SCCNSAM(CCNUBRH).

If you need more details on the constructs of the z/OS XL C++ language, see z/OS XL C/C++ Language Reference or z/OS XL C/C++ Runtime Library Reference.