LoginSignup
0
0

More than 5 years have passed since last update.

Ada言語 3日目 構造体

Last updated at Posted at 2018-12-11

はじめに

まず、今回から コンパイル ~ 実行 の過程を、1日目と同様なので省略します。

そして、今回やったことですが、構造体を使ってみました。
(今回の構造体にはInteger型のメンバしか入っていませんが。)

それではソースをご覧ください。

ソースと実行結果

main.adb

with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;

procedure main is

    type kouzoutai1 is
        record
            mennba1 : Integer;
            menbba2 : Integer;
        end record

    obuzyekuto1 : kouzoutai1;

begin

    obuzyekuto1.mennba1 := 10;
    obuzyekuto1.mennba2 := 20;

    Ada.Integer_Text_IO.Put(obuzyekuto1.mennba1, 1);
    Ada.Integer_Text_IO.Put(obuzyekuto1.mennba2, 1);

end main;

実行結果 : 1020
改行を挟んでいないので見ずらいかもしれませんが、できるだけソースを短くしたかったのでこうなってしまいました。

今後の予定

相変わらず変数。Integer型で配列をやろうと思います。

日記一覧へ

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