comp.lang.ada
 help / color / mirror / Atom feed
* délcarer un array sans indices.
@ 2005-03-20 14:26 Jean-Baptiste CAMPESATO
  2005-03-20 14:31 ` Jean-Baptiste CAMPESATO
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-03-20 14:26 UTC (permalink / raw)


Bonjour,
je voulais savoir s'il y avait un moyen de dï¿œfinir un tableau, sans
donner d'indices, mais de lui donner plus tard ?

Par exemple, j'ai le type :
type Matrice is array ( Integer range <>, Integer range <>) of Float; 
Je souhaite dï¿œclarer une variable gauss, sans indices, de type Matrice et
plus tard dans le programme, suite a une intervention de l'utilisteur
donner les indices adï¿œquates.

Cordialement,
CAMPESATO JeanBaptiste.

PS: ce que je nomme indice sont : le range que je devrais mettre pour
"Integer range <>" ( gauss:matrice(indice1,indice2); , Par exemple).



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: délcarer un array sans indices.
  2005-03-20 14:26 délcarer un array sans indices Jean-Baptiste CAMPESATO
@ 2005-03-20 14:31 ` Jean-Baptiste CAMPESATO
  2005-03-20 14:33 ` Jean-Baptiste CAMPESATO
  2005-03-20 14:36 ` Adrian Knoth
  2 siblings, 0 replies; 8+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-03-20 14:31 UTC (permalink / raw)


Le Sun, 20 Mar 2005 15:26:53 +0100, Jean-Baptiste CAMPESATO a ᅵcritᅵ:

> Bonjour,
> je voulais savoir s'il y avait un moyen de dï¿œfinir un tableau, sans
> donner d'indices, mais de lui donner plus tard ?
> 
> Par exemple, j'ai le type :
> type Matrice is array ( Integer range <>, Integer range <>) of Float; 
> Je souhaite dï¿œclarer une variable gauss, sans indices, de type Matrice et
> plus tard dans le programme, suite a une intervention de l'utilisteur
> donner les indices adï¿œquates.
> 
> Cordialement,
> CAMPESATO JeanBaptiste.
> 
> PS: ce que je nomme indice sont : le range que je devrais mettre pour
> "Integer range <>" ( gauss:matrice(indice1,indice2); , Par exemple).

Excusez moi pour la faute dans le Sujet.
J'ai oubliᅵ de relire le Sujet.
Cordialement,



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: délcarer un array sans indices.
  2005-03-20 14:26 délcarer un array sans indices Jean-Baptiste CAMPESATO
  2005-03-20 14:31 ` Jean-Baptiste CAMPESATO
@ 2005-03-20 14:33 ` Jean-Baptiste CAMPESATO
  2005-03-20 14:36 ` Adrian Knoth
  2 siblings, 0 replies; 8+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-03-20 14:33 UTC (permalink / raw)


Le Sun, 20 Mar 2005 15:26:53 +0100, Jean-Baptiste CAMPESATO a ᅵcritᅵ:

> Bonjour,
> je voulais savoir s'il y avait un moyen de dï¿œfinir un tableau, sans
> donner d'indices, mais de lui donner plus tard ?
> 
> Par exemple, j'ai le type :
> type Matrice is array ( Integer range <>, Integer range <>) of Float; 
> Je souhaite dï¿œclarer une variable gauss, sans indices, de type Matrice et
> plus tard dans le programme, suite a une intervention de l'utilisteur
> donner les indices adï¿œquates.
> 
> Cordialement,
> CAMPESATO JeanBaptiste.
> 
> PS: ce que je nomme indice sont : le range que je devrais mettre pour
> "Integer range <>" ( gauss:matrice(indice1,indice2); , Par exemple).

Ohhhh Scuse :(
I thank i'm in fr.comp...
Oh
My problem is i want to declare a variable type Matrice 
(type Matrice is array ( Integer range <>, Integer range <>) of Float;)
Nut i don't know the range. I will know the range later, by a get from
user.
Thanks.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: délcarer un array sans indices.
  2005-03-20 14:26 délcarer un array sans indices Jean-Baptiste CAMPESATO
  2005-03-20 14:31 ` Jean-Baptiste CAMPESATO
  2005-03-20 14:33 ` Jean-Baptiste CAMPESATO
@ 2005-03-20 14:36 ` Adrian Knoth
  2005-03-20 14:45   ` Jean-Baptiste CAMPESATO
  2 siblings, 1 reply; 8+ messages in thread
From: Adrian Knoth @ 2005-03-20 14:36 UTC (permalink / raw)


Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org> wrote:

> Par exemple, j'ai le type :
> type Matrice is array ( Integer range <>, Integer range <>) of Float; 
> Je souhaite d�clarer une variable gauss, sans indices, de type Matrice et
> plus tard dans le programme, suite a une intervention de l'utilisteur
> donner les indices ad�quates.

Sorry for not answering en fran�aise, I hope you'll still be able
to understand the response:

procedure jean is
   type Matrice is array ( Integer range <>, Integer range <>) of Float;

   procedure something (a, b, c, d : in Positive ) is
      gauss : Matrice (a .. b, c .. d);
   begin
      null;
   end something;

   a, b, c, d : Positive;

begin
   a := 1;
   b := 300;
   c := 1;
   d := 200;
   something (a, b, c, d);
end jean;

Just ask your user about the real values of a,b,c,d. For a large
matrix it could be better to allocate heap memory:

   type Matrice_ptr is access Matrice;
   gauss : Matrice_ptr := new Matrice (a .. b, c .. d);


-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Das Fleisch war willig, doch das Gras war na�



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: délcarer un array sans indices.
  2005-03-20 14:36 ` Adrian Knoth
@ 2005-03-20 14:45   ` Jean-Baptiste CAMPESATO
  2005-03-20 15:09     ` Adrian Knoth
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-03-20 14:45 UTC (permalink / raw)


Le Sun, 20 Mar 2005 14:36:04 +0000, Adrian Knoth a ᅵcritᅵ:

> Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org> wrote:
> 
>> Par exemple, j'ai le type :
>> type Matrice is array ( Integer range <>, Integer range <>) of Float; 
>> Je souhaite dï¿œclarer une variable gauss, sans indices, de type Matrice et
>> plus tard dans le programme, suite a une intervention de l'utilisteur
>> donner les indices adï¿œquates.
> 
> Sorry for not answering en franï¿œaise, I hope you'll still be able
> to understand the response:
> 
> procedure jean is
>    type Matrice is array ( Integer range <>, Integer range <>) of Float;
> 
>    procedure something (a, b, c, d : in Positive ) is
>       gauss : Matrice (a .. b, c .. d);
>    begin
>       null;
>    end something;
> 
>    a, b, c, d : Positive;
> 
> begin
>    a := 1;
>    b := 300;
>    c := 1;
>    d := 200;
>    something (a, b, c, d);
> end jean;
> 
> Just ask your user about the real values of a,b,c,d. For a large
> matrix it could be better to allocate heap memory:
> 
>    type Matrice_ptr is access Matrice;
>    gauss : Matrice_ptr := new Matrice (a .. b, c .. d);

Scuse for post in French, my problem is not exactly that.
My problem is :
I created a type : Matrice.
I want create a variable of Matrice (gauss:Matrice;) when we execute my
programm
But i don't know the range of my matrix. The user will give me
the number of range after.
How can i create a Array without range and after give to the programme the
range ?
thanks a lot



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: délcarer un array sans indices.
  2005-03-20 14:45   ` Jean-Baptiste CAMPESATO
@ 2005-03-20 15:09     ` Adrian Knoth
  2005-03-20 15:12       ` Jean-Baptiste CAMPESATO
  2005-03-20 15:49       ` Marius Amado Alves
  0 siblings, 2 replies; 8+ messages in thread
From: Adrian Knoth @ 2005-03-20 15:09 UTC (permalink / raw)


Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org> wrote:

> Scuse for post in French, my problem is not exactly that.
[..]
> How can i create a Array without range and after give to the programme
> the range?

Exactly how I've shown it: ask the user for a,b,c,d (i.e. Get_Line)
and call your working function (something) with these bounds.

Or if you don't want to put the main work into a separate function,
use the ptr-approach:

   type matrice_ptr is access Matrice;
   
   gauss : matrice_ptr;  --  empty, no size

begin
  Get (a); Get (b); Get (c); Get (d);
  gauss := new Matrice (a .. b, c ..d);
  [..]

-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Wer die H�nde in den Scho� legt, mu� noch lange nicht unt�tig sein



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: délcarer un array sans indices.
  2005-03-20 15:09     ` Adrian Knoth
@ 2005-03-20 15:12       ` Jean-Baptiste CAMPESATO
  2005-03-20 15:49       ` Marius Amado Alves
  1 sibling, 0 replies; 8+ messages in thread
From: Jean-Baptiste CAMPESATO @ 2005-03-20 15:12 UTC (permalink / raw)


Le Sun, 20 Mar 2005 15:09:15 +0000, Adrian Knoth a ᅵcritᅵ:

> Jean-Baptiste CAMPESATO <camje_lemon@nospam.a2lf.org> wrote:
> 
>> Scuse for post in French, my problem is not exactly that.
> [..]
>> How can i create a Array without range and after give to the programme
>> the range?
> 
> Exactly how I've shown it: ask the user for a,b,c,d (i.e. Get_Line)
> and call your working function (something) with these bounds.
> 
> Or if you don't want to put the main work into a separate function,
> use the ptr-approach:
> 
>    type matrice_ptr is access Matrice;
>    
>    gauss : matrice_ptr;  --  empty, no size
> 
> begin
>   Get (a); Get (b); Get (c); Get (d);
>   gauss := new Matrice (a .. b, c ..d);
>   [..]

THANKS A LOT :D





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: délcarer un array sans indices.
  2005-03-20 15:09     ` Adrian Knoth
  2005-03-20 15:12       ` Jean-Baptiste CAMPESATO
@ 2005-03-20 15:49       ` Marius Amado Alves
  1 sibling, 0 replies; 8+ messages in thread
From: Marius Amado Alves @ 2005-03-20 15:49 UTC (permalink / raw)
  To: Adrian Knoth; +Cc: comp.lang.ada

> ...use the ptr-approach:
>
>    type matrice_ptr is access Matrice;
>
>    gauss : matrice_ptr;  --  empty, no size
>
> begin
>   Get (a); Get (b); Get (c); Get (d);
>   gauss := new Matrice (a .. b, c ..d);
>   [..]

You don't need pointers:

declare
    gauss : Matrice (a .. b, c .. d);
begin
    ...




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-03-20 15:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-20 14:26 délcarer un array sans indices Jean-Baptiste CAMPESATO
2005-03-20 14:31 ` Jean-Baptiste CAMPESATO
2005-03-20 14:33 ` Jean-Baptiste CAMPESATO
2005-03-20 14:36 ` Adrian Knoth
2005-03-20 14:45   ` Jean-Baptiste CAMPESATO
2005-03-20 15:09     ` Adrian Knoth
2005-03-20 15:12       ` Jean-Baptiste CAMPESATO
2005-03-20 15:49       ` Marius Amado Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox