配列の各要素に先頭から順に 1,2,3,4,5 を代入して表示

明解C言語 入門編 > 5. 配列 >

配列の各要素に先頭から順に 1,2,3,4,5 を代入して表示

Delphi


program Project1;

{$APPTYPE CONSOLE}

uses
SysUtils;
var
score: array[1..5] of Integer;
begin
score[1] := 1;
score[2] := 2;
score[3] := 3;
score[4] := 4;
score[5] := 5;

writeln(format('点数1 = %d', [score[1]]));
writeln(format('点数2 = %d', [score[2]]));
writeln(format('点数3 = %d', [score[3]]));
writeln(format('点数4 = %d', [score[4]]));
writeln(format('点数5 = %d', [score[5]]));
end.

実行結果

S:\>lesson030\project1.exe
点数1 = 1
点数2 = 2
点数3 = 3
点数4 = 4
点数5 = 5