katarinaknobel

Lektion den 22/9: Array

Sep 22nd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.07 KB | None | 0 0
  1. procedure Xyz is
  2.  
  3. type Row..Type is
  4. array(1..3) of Integer;
  5.  
  6. type Arr_Type is
  7. array (1..10) of Row_Type;
  8.  
  9. A,B: Arr_Type;
  10. begin
  11. A(1)(1):= 0; -- första raden i kolumnen
  12. A(2)(1):= 0;
  13.  
  14. ----------------------------------------------
  15.  
  16. type Tic_Tac_Toe_Type is
  17. array (1..3,1..3) of character;
  18.       -- X Y
  19.       -- Koordinatsystem --> X
  20.                          |
  21.                          | Y
  22.  
  23. T1, T2 = Tic_Tac_Toe_Type;
  24.  
  25. begin
  26. T1(2,2):= 'O';
  27. T1(1,3):= 'X';
  28.  
  29. ----------------------------------------------
  30.  
  31. with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
  32.  
  33. procedure Hp is
  34. procedure Get(Item : out Integer)is
  35.  
  36. begin
  37.  
  38. end Get;
  39.  
  40. X: Integer;
  41.  
  42. begin
  43. Get(X);
  44.  
  45. exception
  46. when Data_Error =>
  47. Put("Fel");
  48.  
  49. end
  50. end loop;
  51. end HP;
  52.  
  53. ----------------------------------------------
  54. (sko-försäljning)
  55.  
  56. type Person_Type is
  57. record
  58. size: Float;
  59. Mailadress: String(1..20);
  60. Gender: Character;
  61. end record;
  62.  
  63. P1, P2 : Person_Type;
  64.  
  65. begin
  66. Get(P1);
  67. P1.Size:= 440;
  68. P1.Mailadress(1):= 'K';
  69.  
  70.  
  71.  
  72.  
  73.  
  74. (Poster: Poster
  75. Fält: Poster
  76. Poster: Fält)
Add Comment
Please, Sign In to add comment