[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

GNU Pascal..............



Hello, im having a little problem here with pascal.


i want to emulate somethig like in bash would be: 
for b in a do; echo $b  , where a,b are strings.


(i _have_ to use pascal)

so im at this point:



a:='Hola soy Phillip';
n:=1;
while n<=length(a) do
begin
b:=' ';
	while a[n]<>chr(32) do
	begin
	b[n]:=a[n];
	n:=n+1;
	end;
writeln(b);
end;


that would print me all the words that are in the a string, right?  Well im not getting anything. writeln(b) wont work. if i do for i:=1 to 255; write(b[i])  it would work, but thats not the idea. Also if i check the length of b, i get length(b)=0, so thats a reason why writeln(b) wont print anything... someboady told me that string[0] has the length of the string, so i have try to set if manually, but every time i write b[0] i get a compilatoin error: "array index out of range"... the person who told me was using turbo pascal for dos...  

so could this be a difference between pascals? or im i doing it wrong?   
whats the problem with the code of upside?...


thanks,
---------------------
    Phillip Neumann
  max@julia.dhis.org


Reply to: