CIS 1033 - Fundamentals of Programming

Bob Comer, Professor, CIS/CSC


Chapter 8 Homework

Click here for answers.

  1. Write declarations for arrays to hold:
    a. 10 float values
    b. 35 integer values
  2. Draw a picture to show the contents of array samp after the following code is executed.
  3. int samp[5], index;
    
    for (index = 0; index < 5; index++)
       samp[index] = index * 2;
  4. Write the declaration for an array called polutionLevel that can hold 300 double values.
  5. Given the declaration for constant BACKGROUND_LEVEL shown below, write code to set all elements in the polutionLevel array to BACKGROUND_LEVEL. You must use a loop. Write declarations for all variables that you use.
    const double BACKGROUND_LEVEL = .0025;
  6. Write a function that counts how many entries in the polutionLevel array have values larger than .05. Your function should return this count as its value. The parameters to your function should include the polutionLevel array and the number of entries in the array.
  7. Modify your function from the previous problem to add a double parameter called safeLevel. Your function should only count the entries that have values larger than safeLevel.


Return to Fundamentals Home Page

URL: http://www.austin.cc.tx.us/comer/cis1033/
Copyright: Ó 1999 by the Austin Community College
Department of Computer Studies. All rights reserved.
Comments to: Bob Comer
Last updated: July 7, 1999

Austin Community College is an equal opportunity educator and employer.