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' );

  seed = 123456789;

  for i = 1 : n
    [ x(i), seed ] = i4_uniform_ab ( 1, 30, seed );
  end

  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
