home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / 30TURUTL / MINMAX.PAS < prev    next >
Pascal/Delphi Source File  |  1985-02-18  |  4KB  |  69 lines

  1. (*----------------------------------------------------------------------*)
  2. (*               Min --- Find minimum of two integers                   *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. Function Min( A, B: Integer ) : Integer;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*   Function: Min                                                      *)
  10. (*                                                                      *)
  11. (*   Purpose:  Returns smaller of two numbers                           *)
  12. (*                                                                      *)
  13. (*   Calling sequence:                                                  *)
  14. (*                                                                      *)
  15. (*      Smaller := MIN( A , B ) : Integer;                              *)
  16. (*                                                                      *)
  17. (*         A       --- 1st input integer number                         *)
  18. (*         B       --- 2nd input integer number                         *)
  19. (*         Smaller --- smaller of A, B returned                         *)
  20. (*                                                                      *)
  21. (*                                                                      *)
  22. (*   Calls:  None                                                       *)
  23. (*                                                                      *)
  24. (*                                                                      *)
  25. (*----------------------------------------------------------------------*)
  26.  
  27. Begin (* Min *)
  28.  
  29.    IF A < B Then
  30.       Min := A
  31.    Else
  32.       Min := B;
  33.  
  34. End   (* Min *);
  35.  
  36. (*----------------------------------------------------------------------*)
  37. (*               Max --- Find maximum of two integers                   *)
  38. (*----------------------------------------------------------------------*)
  39.  
  40. Function Max( A, B: Integer ) : Integer;
  41.  
  42. (*----------------------------------------------------------------------*)
  43. (*                                                                      *)
  44. (*   Function:  Max                                                     *)
  45. (*                                                                      *)
  46. (*   Purpose:  Returns larger of two numbers                            *)
  47. (*                                                                      *)
  48. (*   Calling sequence:                                                  *)
  49. (*                                                                      *)
  50. (*      Larger := MAX( A , B ) : Integer;                               *)
  51. (*                                                                      *)
  52. (*         A       --- 1st input integer number                         *)
  53. (*         B       --- 2nd input integer number                         *)
  54. (*         Larger  --- Larger of A, B returned                          *)
  55. (*                                                                      *)
  56. (*                                                                      *)
  57. (*   Calls:  None                                                       *)
  58. (*                                                                      *)
  59. (*----------------------------------------------------------------------*)
  60.  
  61. Begin (* Max *)
  62.  
  63.    IF A > B Then
  64.       Max := A
  65.    Else
  66.       Max := B;
  67.  
  68. End   (* Max *);
  69.