CPS 108, Spring 2004, Read Performance Questions

Questions based on the code in readperformance.cpp.

  1. Compare and contrast (at a high level) the methods used in SimpleReader and RawReader to differentiate between reading from a file and from standard input.
    
    
    
    
    
    
    
    
  2. In RawReader the methods readStdin and readFile are private and both have the same last line. Explain why they're private and how to avoid the code-duplication that stems from that same last-line.
    
    
    
    
    
    
    
  3. Explain how to (simply) convert all words to lower case in the SimpleReader class.
    
    
    
    
    
    
    
    
    
    
  4. Explain how to convert all words to lower case in the RawReader class.
    
    
    
    
    
    
    
    
    
    
    

Owen L. Astrachan
Last modified: Fri Jan 23 12:40:37 EST 2004