     FILTER     -,  
-  DOS. ,  FILTER    
,   DOS filter <filter.cpp.    
     filter >prn.     , 
 filter <filename.ext >prn. 
     7  FILTER.  cin.get(c)   .  
cin.get(c)    int      
 .  8        . 

        

         - C++    
    .  12.4    
        . 
     Easy Win-  Windows  
 DOS-    .    
(, XXX   )  ,  ,  
  . 

     12.4.    GETVAL.CPP (   - 
    ) 

    1:	#include <iostream.h> 
    2:	#include <stdlib.h> 
    3: 
    4:	void test(void); 
    5: 
    6:	main() 
    7:	{ 
    8:	  double fp;  //   
    9:	  long k;  //   10: 
    11:	  cout  "Enter a floating-point value:   "; 
    12:	  cin  fp; 
    13:	  test(); 
    14:	  cout  "Value entered is:   "  fp   '\n'; 
    15:	  cout  "Enter an integer value:   "; 
    16:	  cin  k; 
    17:	  test(); 
    18:	  cout  "Value entered is:   "  k   '\n'; 
    19:	  return 0; 
    20:	} 
    21: 
    22:	void test(void) 
    23:	{ 
    24:	  if (Icin.goodO) { 
    25:	    cout  "Error detected"; 
    26:	    exit(1); 
    27:	  } 
    28:	}

     11   ,    
    fp  double   12.   
   16   .     
-,         scanfO  
 ,       , 
 -    ,   
 -.        
,       ,       
  -.  C++     
   ! 
     13  17       
-.      testO,   
 22-28. 
        cin.good()  -,  
 TRUE,        .  
 cout. good()       .   
 ,  cin.good()  FALSE,  25-26  
    . 
           .   
     

    cin.clear(); 

      15    -   -. 


     12.   C++	283 
