7.1. Introduction

This chapter discusses arrays, which are fixed-size collections consisting of data items of the same type, and vectors which are collections (also of data items of the same type) that can grow and shrink dynamically at execution time. Both array and vector are C++ standard library class templates. To use them, you must include the <array> and <vector> headers respectively.

After discussing how arrays are declared, created and initialized, we present examples that demonstrate several common array manipulations. We show how to search arrays to find particular elements and sort arrays to put their data in order.

We enhance the GradeBook class by using both one and two-dimensional arrays to maintain a set of grades in memory and analyze the grades from multiple exams. We introduce the exception-handling mechanism and use it to allow a program to continue executing when the program attempts to access an array or vector element that does not exist.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.109.21