function i4vec_max_last_test ( )

%*****************************************************************************80
%
%% i4vec_max_last_test() tests i4vec_max_last().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 January 2018
%
%  Author:
%
%   John Burkardt
%
  n = 10;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'i4vec_max_last_test():\n' );
  fprintf ( 1, '  i4vec_max_last() identifies the largest element in an\n' );
  fprintf ( 1, '  I4VEC, and moves it to the final entry.\n' );

  x = randi ( [ 1, 30], n );

  i4vec_print ( n, x, '  Input vector:' );

  [ x, x_max ] = i4vec_max_last ( n, x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Maximum: %d\n', x_max );

  i4vec_print ( n, x, '  Output vector:' );

  return
end
