|
| Re: Array of string... |
 |
27 Dec 2006 06:41:27 -0800 |
On 2006-12-27, Christen Fihl <look_at_HSPascal.fihl.net@nospam.plz>
wrote:
>
> correct:
> type parole=string;
> type vettore=array[5] of parole; max 5 strings in array
>
That won't compile either; I'd change it to
type
vettor = array[1..5] of parole; { 5 strings in the array}
|
| Post Reply
|
| Re: Array of string... |
 |
Wed, 27 Dec 2006 10:56:51 -080 |
On Wed, 27 Dec 2006 11:06:22 GMT, "Alberto"
<darsana85@libero.it>
wrote:
>How can i create an array of string ?
>I try to write this code but it isn't right:
>
>type parole=string;
>type vettore=array of parole;
>
>var v:vettore;
> frase:parole;
> i:integer;
>begin
> for i:=1 to 5 do
> begin
> writeln('Inserisci una frase, digita 0 per terminare: ');
> readln(frase);
> if (frase<>'0') then
> v[i]:=frase;
> end;
>
>
>end.
You have to set the length of a dynamic array before you do anything
with it. They are always created at length zero.
|
| Post Reply
|
| Array of string... |
 |
Wed, 27 Dec 2006 11:06:22 GMT |
How can i create an array of string ?
I try to write this code but it isn't right:
type parole=string;
type vettore=array of parole;
var v:vettore;
frase:parole;
i:integer;
begin
for i:=1 to 5 do
begin
writeln('Inserisci una frase, digita 0 per terminare: ');
readln(frase);
if (frase<>'0') then
v[i]:=frase;
end;
end.
|
| Post Reply
|
| Re: Array of string... |
 |
Wed, 27 Dec 2006 13:10:05 +010 |
Alberto
You need to tell how big an array. (Else you need pointers)
you wrote:
type parole=string;
type vettore=array of parole; no count
correct:
type parole=string;
type vettore=array[5] of parole; max 5 strings in array
Christen
|
| Post Reply
|
| Re: Array of string... |
 |
Wed, 27 Dec 2006 17:18:48 +010 |
Sure, my mistake.
Normally when programming, I let the fingers do the typing.
When answering mails outside of Turbo/Delphi, I let the brain with all
its faults do the work ;-)
Christen
|
| Post Reply
|
|
|
|
|
|
|
|
|
|