That code won't even compile: your Get function has a code path where no result is returned - when the
if
condition fails. You will need to decide what to do at that point, and how to return or handle an error at runtime.
Then to fix the problem you have noticed, replace this:
Array arr={8,3,9,15,6,10,7,2,12,4};
With this:
Array arr;
int i = 0;
arr.Set(i++, 8);
arr.Set(i++, 3);
arr.Set(i++, 9);
arr.Set(i++, 15);
arr.Set(i++, 6);
arr.Set(i++, 10);
arr.Set(i++, 7);
arr.Set(i++, 2);
arr.Set(i++, 12);
arr.Set(i++, 4);