| 
	 SCATMECH > Classes and Functions >
        Utility > User
        interface functions
         User interface functions
         
        A set of functions which aid the programmer in querying the
        user for values.
         Include files:
          
#include "askuser.h"
 
        Source code:
          
askuser.cpp
 
        See also:
        SCATMECH Home,  
        Console Interface
          
	Definition of functions:
          
template  TYPE AskUser(const std::string& prompt, const TYPE& deflt	);
string AskUser(const std::string& prompt, const char* deflt);	
void    SCATMECH_set_istream(istream& is);
void    SCATMECH_set_ostream(ostream& os);
 
         
        
        
          These functions send the character string 
          query to the output stream (which, by default, is cerr) and wait
          for response from the user. If the user types only
          "return," the function returns the default value deflt.
          Otherwise, it returns the value typed in by the
          user. 
	  Any data type TYPE may be used, provided that the binary operators << and >> are defined
	  for the input and output streams.  Thus, TYPE can be dielectric_function or 
	  Table.
	 Example:
          
double thetai = AskUser("Incident angle",45.);
int npoints = AskUser("Number of points",100);
string options = AskUser("Enter options","AB");
dielectric_function df = AskUser("Optical constant of substrate",dielectric_function(17.22,0.415));
         
        Top of Page 
	
        
          The above functions AskUser use a
          predefined input stream and output stream. By default, these are cin, and
          cerr, which are
          adequate for simple console routines. However, it may be
          useful for some routines to use different
          iostreams.  These function can be used to set these functions differently. 
        Example:
         
        Top of Page 
 
For More Information
SCATMECH Technical Information and Questions 
Sensor Science Division Home Page 
Sensor Science Division Inquiries 
Website Comments
 
Current SCATMECH version: 7.22 (April 2021) 
 
  |