Skip to main content

Exercises 6.8 Exercises

This chapter does not have automatically graded exercises like other ones. Instead, it includes open ended activities to explore what is covered in this chapter.

Activity 6.8.1.

In the development environment of your choice, set up a multiple file project. It should consist of:
  • A .cpp file that has a simple function like int countSpaces(const string& text);.
  • A .h file that declares that function.
  • A second .cpp file with a main function that uses that function and includes the .h file.
Make sure you can:
  • Compile (but not link) each .cpp file on its own.
  • Build the full program by compiling and linking all .cpp files together.

Activity 6.8.2.

In the development environment of your choice, set up a multiple file project. It should consist of:
  • A .cxx file that exports a module called CountSpaces. It should define and export a function called int countSpaces(const string& text);.
  • A second .cpp file with a main function that uses that function and imports the CountSpaces module.
Make sure you can:
  • Build the full program by compiling and linking all .cpp files together.
You have attempted of activities on this page.