CS 151                                                               Spring 2015

                        Class Exercise:  Array of numbers

                        
Simple (atomic) Variable: indivisible--a name for a place that holds one value.

Composite Variable: a named collection of data items such as an array or record.

Array:  A named collection of a fixed number of homogeneous items in which the 
   the items are accessed by their place in the collection. 

General Form:
   dataType arrayName[intExp];  for example:  int item[10];

Index:  A non-negative integer that specifies the position of a component in
   an array.  For example:  item[4] = 100;
   assigns the value 100 to element 4 (relative to zero, so the fifth element).

For questions 1 and 2, use simple variables, not an array.
1.  Declare three integer variables, input values, then print their sum.




2.  Find and print that input value which is lower in value than referenced
    by any other input variable. Hint: assume the first is the lowest, store,
    then compare to the next and so forth.





    
For questions 3 through 7, use the structured data type called an array.
3.  Declare score[] to have five integer components. Initialize each 
    component (element) to zero as part of the array declaration.



4.  Prepare a program fragment composed of a loop that will input
    and store five values as elements of score[] defined in step 3.



5.  Code a loop with statements for summing the score[] values. Output the sum.    





6. Compute the score average, then prepare a loop with statements to output a
   score[] value alongside the message "above" or "equal" or "below" average. 








   
   
7.  Write a program fragment to find, store, then print the index and 
    the value of the lowest element value in score[].