home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / cdactual / demobin / share / program / C / ANSICPP.ZIP / EX02001.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-24  |  500 b   |  21 lines

  1. // ex02001.cpp
  2. // A program with default parameters in a function prototype
  3. #include <iostream.h>
  4.  
  5. void show(int = 1, float = 2.3, long = 4);
  6.  
  7. main()
  8. {
  9.     show();                 // all three parameters default
  10.     show(5);             // provide 1st parameter
  11.     show(6, 7.8);         // provide 1st two
  12.     show(9, 10.11, 12L); // provide all three parameters
  13. }
  14.  
  15. void show(int first, float second, long third)
  16. {
  17.     cout << "\nfirst = "  << first;
  18.     cout << ", second = " << second;
  19.     cout << ", third = "  << third;
  20. }
  21.