Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- w ads widoczne w mainie;
- -- GARAZ REKORD--
- -----------------
- with Ada.Text_IO;
- use Ada.Text_IO;
- with Ada.Integer_Text_IO;
- use Ada.Integer_Text_IO;
- with Ada.Numerics.Elementary_Functions;
- use Ada.Numerics.Elementary_Functions;
- with Ada.Float_Text_IO;
- use Ada.Float_Text_IO;
- with zmiana;
- use zmiana;
- procedure Main is
- a : Float;
- b : Float;
- c : Float;
- type Kolor is (red, green, blue);
- type Samochod is record
- karoserja: Kolor;
- rejestracja: String(1..6);
- rok_prod: Integer;
- end record;
- type G is array (Positive range <>) of Samochod;
- M_G : G(1..5);
- car1 : Samochod:= (red, "ZK1 xD", 1995);
- car2 : Samochod:= (green, "ZK2lel", 1925);
- begin
- M_G(1) := car1;
- M_G(2) := car2;
- Put(M_G(1).rejestracja);
- end Main;
- 0-0--0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
- =================================================
- = = = = = = = = = = = = = = = = = = = = = = = = =
- -------------------------------------------------
- -------------------------------------------------
- -- KLASA PUNKT --
- -------------------------------------------------
- -------------------------------------------------
- 0-0--0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0
- =================================================
- = = = = = = = = = = = = = = = = = = = = = = = = =
- PLIK ADS
- package zmiana is
- type point is tagged recond
- X : Integer;
- Y : Integer;
- end record;
- function obliczPole(pkt: point) return Float;
- end zmiana;
- PLIK ADB
- package body zmiana is
- function obliczPole(pkt: point) return Float is
- begin
- return 0.0;
- end obliczPole;
- end zmiana;
- ---------------------------
- druga klasa: KOLO:
- ----------------------------
- -----------------------------
- PLIK ADS
- package zmiana2 is
- type kolo is new point with record
- r: Float;
- end record;
- function obliczPole(pkt: kolo) return Float;
- end zmiana2;
- PLIK ADB
- package zmiana2 body is
- function obliczPole(pkt: kolo) return Float
- begin
- return 3.14 * k.r**2;
- end obliczPole;
- end zmiana2;
- MAIN:
- pkt: Point := (2,3);
- kol : Kolo :=(2,3,4.5);
- begin
- obliczPole(pkt);
- obliczPole(kol);
- ----------------------------------------------
- ------------------------------------------------
- ------------------------------------------------
- ------- WĄTKI - > TASKI ------------------------
- ------------------------------------------------
- ------------------------------------------------
- with Ada.Text_IO;
- use Ada.Text_IO;
- with Ada.Integer_Text_IO;
- use Ada.Integer_Text_IO;
- with Ada.Numerics.Elementary_Functions;
- use Ada.Numerics.Elementary_Functions;
- with Ada.Float_Text_IO;
- use Ada.Float_Text_IO;
- procedure Main is
- D1 : Duration;
- D2 : Duration;
- task zadanie1;
- task body zadanie1 is
- begin
- D1 := Duration(0.5);
- for i in 1..120 loop
- Put("HEJ!");
- New_Line;
- delay D1;
- end loop;
- end zadanie1;
- task zadanie2;
- task body zadanie2 is
- begin
- D2 := Duration(0.75);
- for i in 1..120 loop
- Put("HO!");
- New_Line;
- delay D2;
- end loop;
- end zadanie2;
- begin
- null;
- end Main;
- -------------------------------------------
- -
- -------------------------------------------
- -
- -
- ---------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement