Name: ____________________________________________________ Alpha: _____________Section: ________

Describe help received: _________________________________________________________________

See the bottom for how to submit your work.

Due: Before 0800 on next class day

  1. (10 pts) Read lecture notes from today. Honestly declare how you read the notes.
    1. (10 pts) I read the notes carefully. I have a good understanding of the topics therein.
    2. (10 pts) I read the notes carefully, but I don't really understand the following points well:
      
      
      
      
    3. (0 pts) I didn't read the notes carefully.
  2. [20pts] Below is a program that should work as follows: Fill out the blanks below so the program works as expected.
    
    #include <iostream>
    #include <fstream>
    using namespace std;
    
    int main()
    {
      ifstream f1("in.txt");
      
      ____________________________;                // fill here 
    
      char c;
      int x, y;
      while( f1 >> c >> x >> c >> y >> c )         // fill here
      { 
        if( (x != 2) ________________ )            // fill here
    
          _____________________________________;   // fill here
        else
    
          _____________________________________;   // fill here
      }
    
      return 0;
    }
    
       in.txt:
     (1,2) (2,3) (2,1) (1,3) (10,1) (2,3)
    out.txt:
     (1,2) (0,0) (2,1) (1,3) (10,1) (0,0)
  3. [70 pts] Write a program hw.cpp that prints rectangles (in text) on the screen. The outline of the rectangles should be in * characters and the inside should be empty (i.e., filled with spaces).

    Your rectangle will have a certain height and width, as well as an offset which is a number of spaces to the left of the left side of your rectangle.

    Here are some examples of how your program should work:

    ~$ ./hw
    Enter height (greater than 2): 5
    Enter width  (greater than 2): 8
    Enter offset: 3
       ********
       *      *
       *      *
       *      *
       ********
    ~$ ./hw
    Enter height (greater than 2): 3
    Enter width  (greater than 2): 10
    Enter offset: 7
           **********
           *        *
           **********
    

    In writing your program, use the idea of stepwise refinement that we talked about in class. You may assume that the height and width will always be at least 2.

Submit to the submission server (due: 0800 on the next class day)

 ~/bin/submit -c=IC210 -p=hw13 hw.cpp 
Bring to class