# Array Analysis?????

I have an array with up to 200 numbers in it and need to find out how to go about getting the frequencies of each number in the array. IE.

In the array I have - 1 2 2 3 2 4 3
i need to write the program that will tell me there are 3 number two's, 1 number one, 2 threes, and one four.

I have used one of those memo thing to collect the numbers and then i convert them into numbers for the array.

I desperatly need this help before an exam tommorow!!

CAN ANYBODY HELP????????????
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Is there a range to these numbers, I mean, say from 1 to 50?
0
Commented:
Which version of Delphi?
Do you know the number of value before the start of the process?
Is 200 the absolute maximum of values, or is it only an example?
0
Commented:
Dave, try this:

procedure TForm1.Button1Click(Sender: TObject);
var iIntArray: array[1..7] of integer;
iCounter: Integer;
iArrayValue: Integer;
begin
{populate the array}
iIntArray[1] := 1;
iIntArray[2] := 2;
iIntArray[3] := 2;
iIntArray[4] := 3;
iIntArray[5] := 2;
iIntArray[6] := 4;
iIntArray[7] := 3;
{Here we'll use a listbox to display the counts (frequency) of
for iCounter := 1 to High(iIntArray)  do
Begin
end;

{Now we scan the array to get the frequency of the numbers}
{Code broken down for simplicity and understanding}
For iCounter := 1 to High(iIntArray) do
Begin
iArrayValue := iIntArray[iCounter];
ListBox1.Items[iArrayValue-1] :=
IntToStr(StrToInt(ListBox1.Items[iArrayValue-1]) + 1);
end;

{Done counting, now let's pretty up the results}
For iCounter := 1 to High(iIntArray) do
Begin
ListBox1.Items[iCounter-1] :=
IntToStr(iCounter) + '''s count is ' +
ListBox1.Items[iCounter-1];

end;

end;