Home Segments Index Top Previous Next

87: Mainline

You can incorporate multiple input operators into one input statement for the same reason that you can include multiple output operators into one output statement: In C++, each input expression refers to the same chunk of memory that is referred to by that input expression's left-side operand. Accordingly, the input expression cin >> height refers to a chunk of memory that specifies an input place, and that chunk of memory is the same chunk of memory that is named by cin:

      *--------------------------* 
      |                          | 
------*------                    |   
cin >> height                    | 
-*-                              |   
 |                               |   
 *-----------------------------* | 
                               | | 
                               v v 
                              *-----*-----*-----*-----*-- 
                              |     |     |     |     | 
                              *-----*-----*-----*-----*---