LoginSignup
0
0

More than 5 years have passed since last update.

Ada言語 16日目 キャスト

Posted at

はじめに

いままでソースの上でwithuseを両方書いていましたが、やっとuseの意味が分かったので今回からwithだけにします。

ソースと結果

main.adb
with Ada.Integer_Text_IO;
with Ada.Float_Text_IO;
with Ada.Text_IO;

procedure main is

   hennsuu1 : Integer := 5;
   hennsuu2 : Integer := 2;
   hennsuu3 : Float;

begin

   hennsuu3 := Float (hennsuu1) / Float (hennsuu2);

   Ada.Float_Text_IO.Put(hennsuu3, 0);

end main;

実行結果 : 2.50000E+00

おわりに

今回はキャストでした。C言語とは違い、変数のほうを括弧でくくるようです。

日記一覧へ

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