본문/내용
Chapter 1: Introduction
1.4 The general way to do this is to write a procedure with heading void processFile( String ?leName ); which opens ?leName, does whatever processing is needed, and then closes it. If a line of the form #include SomeFile is detected, then the call processFile( SomeFile ); is made recursively. Self-referential includes can be detected by keeping a list of ?les for which a call to processFile has not yet terminated, and checking this list before making a new call to processFile. 1.5 The code is shown in Fig. 1.1. _ ______________________________________________________________________________ int ones( int n ) { if( n [ 2 ) return n; return n % 2 + ones( n / 2 ); } Fig. 1.1. _ ______________________________________________________________________________ 1.7 (a) The proof is by induction. The theorem is clearly true for 0 [ X ≤ 1, since it is true for X 〓 1, and for X [ 1, log X is negative. It is also easy to see that the theorem holds for 1 [ X ≤ 2, since it…