%  Script file: test_c_sort1.m
%
%  Purpose: 
%    To read in an set of input strings, sort them
%    into ascending order, and to write the sorted
%    data to the Command window.  This program uses
%    function "c_sort1" to do the actual sorting.
%
%  Record of revisions:
%      Date       Programmer          Description of change
%      ====       ==========          =====================
%    03/19/00    S. J. Chapman        Original code 
%
% Define variables:
%   array  -- Input data array
%   ii     -- Index variable
%   nvals  -- Number of input values
%   sorted -- Sorted data array

% Prompt for the number of values in the data set
nvals = input('Enter number of strings to sort:  ');

% Preallocate array
array = cell(1,1);

% Get input values 
for ii = 1:nvals

   % Prompt for next value
   string = ['Enter string ' int2str(ii) ':  '];
   array{ii} = input(string,'s');
end

% Now sort the data
sorted = c_sort1(array);

% Display the sorted result.
fprintf('\nSorted strings:\n');
for ii = 1:nvals
   fprintf(' %s\n',sorted{ii});
end
