Original Post
need help sorting an array where the number of digits is abstract. i know how to reform a four digit number or any other number but how do I do it with an array when the number of digits is unknown until it is inputted? For example: I know to resort a 4 digit number I would do the following: Digit : Natural; Digit := Dgt1 * 1000; Digit := Digit + ( Dgt2 * 100 ); Digit := Digit + ( Dgt3 * 10 ); Digit := Digit + Dgt4; but for an array whose index/element is from 1 .. X, where X is a number that is determined by input, how do I resort? I know I should do this in a for loop (in ada 95 ) for count in 1 .. array'last loop -- what do I do here? end loop; Thanks. Response examples in ada95 or C++ please. *added* I know to extract an array I would do: FOR count IN 1 .. xdigit LOOP kapArray( count ) := tempNum rem 10; tempNum := tempNum / 10; END LOOP; I wonder if reversing this would reform somehow?