0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ada言語 4日目 配列

Last updated at Posted at 2018-12-12

#はじめに
今回は、Integer型で1次元配列、2次元配列をやってみました。
for文をまだやっていないので初期化した配列の全てを表示させることはしませんでした。

#ソースと実行結果

main.adb

with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;

procedure main is

	hairetu1 : array (0 .. 3) of Integer := (2, 3, 5, 7);
	hairetu2 : array (0 .. 1) of Integer;
	nizigenn_hairetu1 : array (0 .. 1, 0 .. 3) of Integer;

begin

	hairetu2(0) := 56;
	hairetu2(1) := 24;

	nizigenn_hairetu1(0, 0) := 1;
	nizigenn_hairetu1(0, 1) := 2;
	nizigenn_hairetu1(0, 2) := 3;
	nizigenn_hairetu1(0, 3) := 4;

	nizigenn_hairetu1(1, 0) := 5;
	nizigenn_hairetu1(1, 1) := 6;
	nizigenn_hairetu1(1, 2) := 7;
	nizigenn_hairetu1(1, 3) := 8;

	Ada.Integer_Text_IO.Put(hairetu1(0), 1);
	Ada.Integer_Text_IO.Put(hairetu1(3), 1);
	Ada.Integer_Text_IO.Put(hairetu2(0), 1);
	Ada.Integer_Text_IO.Put(hairetu2(1), 1);
	Ada.Integer_Text_IO.Put(nizigenn_hairetu1(0, 0), 1);
	Ada.Integer_Text_IO.Put(nizigenn_hairetu1(1, 3), 1);

end main;

実行結果 : 27562418

#今後の予定
ポインタが使えるらしいのでやるしかない。
その前に制御文をやらなければ。

#日記一覧へ
Ada言語を習得する日記一覧

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?