CS368 Fall 2009

Assignment 1

Due by the beginning of class on Wed. September 16

Print out your answers (or hand write them on paper) and turn them in.

  1. Give a declaration for
  2. How many array elements result from the following array declaration?
        char errormsg[] = "Bad input.\n";
    
  3. Write a C++ code fragment (not a declaration) that initializes the honors array, such that the ID for each student is set to 100000 + the array index value, the major for each student is set to 20, and the gpa for each student is 0.0.
  4. The wayward programmer has a program containing the following code:
       double weights[] = {16.2, 85.0, 76.3, 13.4, 18.1, 18.1,
                           19.9, 26.55, 88.1, 51.0};
    
       for ( i = 0; i < 15; i++) {
          weights[i] = weights[i+1] - 12.6;
       }
    



© 2009 Karen Miller