home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / CPTUTOR2.ZIP / FUNCPNT.CPP < prev    next >
Text File  |  1990-07-20  |  1KB  |  53 lines

  1.                                       // Chapter 3 - Program 3
  2. #include "iostream.h"
  3. #include "stdio.h"
  4.  
  5. void print_stuff(float data_to_ignore);
  6. void print_message(float list_this_data);
  7. void print_float(float data_to_print);
  8. void (*function_pointer)(float);
  9.  
  10. main()
  11. {
  12. float pi = 3.14159;
  13. float two_pi = 2.0 * pi;
  14.  
  15.    print_stuff(pi);
  16.    function_pointer = print_stuff;
  17.    function_pointer(pi);
  18.    function_pointer = print_message;
  19.    function_pointer(two_pi);
  20.    function_pointer(13.0);
  21.    function_pointer = print_float;
  22.    function_pointer(pi);
  23.    print_float(pi);
  24. }
  25.  
  26.  
  27. void print_stuff(float data_to_ignore)
  28. {
  29.    printf("This is the print stuff function.\n");
  30. }
  31.  
  32.  
  33. void print_message(float list_this_data)
  34. {
  35.    printf("The data to be listed is %f\n", list_this_data);
  36. }
  37.  
  38.  
  39. void print_float(float data_to_print)
  40. {
  41.    printf("The data to be printed is %f\n", data_to_print);
  42. }
  43.  
  44.  
  45. // Result of execution
  46. //
  47. // This is the print stuff function.
  48. // This is the print stuff function.
  49. // The data to be listed is 6.283180
  50. // The data to be listed is 13.000000
  51. // The data to be printed is 3.141590
  52. // The data to be printed is 3.141590
  53.