 ,     ++ 
  :    .

   UNIX,         
,  .C    ++ ,    
bookstore.C    ++.

   ,    DOS,     
 ,       
   ++.     .cpp 
.cxx: bookstore.cpp, bookstore.cxx.

  ++        
 (     ,     ++ 
 ). 

++   26

$ CC prog1.C

 $     . CC  
 ++,    UNIX-.   
     .




1.3.  

#include "my_file.h"

       (<>), ,    
  ,       
. (         
.)   ,     , 
     ,     .

      #include.  
 ,         
,         .
     .  :

#ifndef BOOKSTORE_H
#endif

  #ifndef ,     BOOKSTORE_H 
. (BOOKSTORE_H    ;    
 .)      
 #endif.        #ifndef  # endif.



#define BOOKSTORE_H

   BOOKSTORE_H.   
   #ifndef,   , 
    bookstore.h    
   ,          .

      
      . :

         
    -D (     
 -).  UNIX-    
  DEBUG   :

$ CC -DDEBUG main.C

 ,    . , 
 ,    ++   .  ++ 
   __cplusplus ( ). 
   __STDC__. ,     
 . :

    (    
)   __LINE__  __FILE__.  __LINE__
    ,  __FILE__   
.    :

int main()
#idfef __cplusplus
//  ++ 
extern "C";
// extern "C"    7
#endif

33

cerr << ". : " << __FILE__
<< " : " << __LINE__
<< "element_count    0";

  __DATE__  __TIME__     .

      assert(),  
    ,    ,  
    .    
   

#include <assert.h>

assert.h       .   C++ 
       ,   C,    ,
  C++.    ++     cassert. 
    ++      
   .h     c ( 
,      C++   ,
     ).

     #include   
 . 

#include <cassert>

      cassert.    ,
    ++,    std, 
assert()     ,         
 using-:

using namespace std;

          
#include <assert.h>
   using- :  assert()    2.

2    ,      ,
        .

       .

          
   :

   /* * /

  */       ,
    .

      ?    
    2.2,   ,   

   while ( cin >> word )
   // ...

         ,     .



   ( cin >> word )

 false,    . (      20.) 
   ,      cin 
   cout:

   #include <iostream>
   #include <string>
   int main ()
   {
      string word;
      while ( cin >> word )
         cout << " : " << word << "\n";
      cout << "  !";
   }

        :
riverrun, past Eve and Adam's

         
,      :

 : riverrun,
 : past
 : Eve,
 : and
 : Adam's


    ,      in_file 
      ,   ,   ,
 out_file.

   #include <iostream>
   #include <fstream>
   #include <string>

   int main()
   {
       ifstream infile("in_file");
       ofstream outfile("out_file");

       if ( ! infile ) {
          cerr << "   .\n"
          return -1;
       }

       if ( ! outfile ) {
            cerr << "   .\n"
            return -2;
       }

       string word;
       while ( infile >> word )
         outfile << word << ' ';
       return 0;
    
    }


39
