Fill an array with one string

FlamingClaw 0 Tallied Votes 212 Views Share

This little program a solution for putting a string into an array.
The method is that the string is divided for chars....
By FlamingClaw

Program StringIntoArray;

Uses Crt;
Const max = 11;
Var S:String[max];
    i:Byte;
    size:Byte;
    Ar:Array[1..max]of Char;


Begin {main}
     ClrScr;
     Write('Give me the word,max 11 char: ');
     ReadLn(S);
     size:=Length(S);
     For i:=1 To size Do
        Begin
           Ar[i]:=S[i];
           If (i = size) Then Break;
        End;

     {Now write the results}
     For i:=1 To size Do WriteLn(Ar[i]);

     ReadKey;
End. {main}
(*Created By FlamingClaw 2009.03.11*)