7Arrays

7.1 Using Arrays

7.2 Creating, Inputting, and Copying an Array

7.3 Arrays of Objects and a Simulation

7.4 Multidimensional Arrays

7.5 (Optional) Solving Problems with C#: Insertion Sort

Each variable of one of the primitive types holds a single value. Using an integer variable score to hold a single test score, we can write a program to add a list of test scores. Once we add a score to the total we no longer need that value, and could read the next test score and save it in the same variable, score.

Suppose, however, that we want to arrange the scores from highest to lowest, displaying an ordered list of all scores. To sort the scores, we need to have them all available so we can compare one score with another. Using variables of type ...

Get Computing with C# and the .NET Framework, 2nd Edition 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.