Appendix

About

This section is included to assist the students to perform the activities present in the book. It includes detailed steps that are to be performed by the students to complete and achieve the objectives of the book.

1. Your First C++ Application

Activity 1: Write Your Own C++ Application

Solution:

  1. Define your age bracket thresholds using #defines.
  2. Define a name for each group using #defines.

    Here is the code required for steps 1 and 2:

    // Activity 1.

    #include <iostream>

    #include <string>

    #define GROUP_1_THRESHOLD 12

    #define GROUP_2_THRESHOLD 28

    #define GROUP_1_NAME "Group A"

    #define GROUP_2_NAME "Group B"

    #define GROUP_3_NAME "Group C"

  3. Output a text string asking the user for their name and capture the response in a variable. ...

Get The C++ Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.