Array Basics: Declaring and Using a Simple Array

The goal for this exercise is to make sure that you can create a simple, integer array, and both put values into it, and get values back out of it.

What you need to do to prepare for this exercise:


What you need to do for this exercise
  1. In the starter project, add code to the Array_Basics class, so that the RunExercise method does the following:

    1. Declare an array of 10 integers

    2. Use a for loop to initialize the array with user input from the keyboard.

    3. Display the contents of the array to the screen using another for loop.

  2. Once you’ve done that, build on your existing code by:

    1. Creating a second array, with 5 integers, and try initializing the array with 5 integer values directly inside the declaration (i.e., set things up so that when you create the array, it will store values such as 1, 10, 100, 1000, 10000).These integer values will be chosen by you when you write the program (i.e., the user will not input the values for the second array).

    2. Print out this second array, too