Advertisement
Paszta

Niskopoziomówka lab7

Nov 19th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. 1.
  2.  
  3. program trojwymiar;
  4. #include("stdlib.hhf");
  5. static
  6. tab3: int32[3,4,5]:= [111,112,113,114,115,
  7. 121,122,123,124,125,
  8. 131,132,133,134,135,
  9. 141,142,143,144,145,
  10.  
  11. 211,212,213,214,215,
  12. 221,222,223,224,225,
  13. 231,232,233,234,235,
  14. 241,242,243,244,245,
  15.  
  16. 311,312,313,314,315,
  17. 321,322,323,324,325,
  18. 331,332,333,334,335,
  19. 341,342,343,344,345,];
  20.  
  21. kolumna: int32;
  22. wiersz: int32;
  23. warstwa: int32;
  24.  
  25. begin trojwymiar;
  26. stdout.put("Podaj kolumne: ", nl);
  27. stdin.get(kolumna);
  28. if(kolumna <= 5)then
  29. dec(kolumna);
  30. else
  31. stdout.put("Podano niewlasciwa kolumne!! Prosze podac nowa", nl);
  32. stdin.get(kolumna);
  33. dec(kolumna);
  34. endif;
  35. stdout.put("Podaj wiersz: ", nl);
  36. stdin.get(wiersz);
  37. dec(wiersz);
  38. stdout.put("Podaj warstwe: ", nl);
  39. stdin.get(warstwa);
  40. dec(warstwa);
  41.  
  42. mov(warstwa, EAX);
  43. intmul(4, EAX);
  44. add(wiersz, EAX);
  45. intmul(5,EAX);
  46. add(kolumna, EAX);
  47.  
  48. stdout.put(" Wybrany element ma wartosc: ", tab3[EAX*4], nl);
  49.  
  50.  
  51.  
  52. end trojwymiar;
  53.  
  54. 2. Zerowanie tablicy
  55.  
  56. program procedurki;
  57. #include("stdlib.hhf");
  58. static
  59. tabliczka: int32[257];
  60. i: int32:= 0;
  61.  
  62. procedure zerowanko;
  63.  
  64. static
  65. j: int32:=0;
  66. hooy: int32;
  67.  
  68. begin zerowanko;
  69. stdout.put("Podaj numer od ktorego chcesz zerowac", nl);
  70. stdin.get(hooy);
  71. mov(hooy,ECX);
  72. stdout.puti32(ECX);
  73. stdout.newln();
  74.  
  75. if(ECX > 256 || ECX < 1) then
  76. stdout.put("Podano niewlasciwy numer, prosze poprawic", nl);
  77. stdin.get(hooy);
  78. mov(hooy,ECX);
  79. dec(ECX);
  80. else
  81. stdout.put("Wszysko dziala", nl);
  82. dec(ECX);
  83. endif;
  84.  
  85.  
  86. //mov(33,ECX);
  87. for(mov(j,EAX); j<256; inc(j)) do
  88. if(ECX > j) then
  89. mov(j,EBX);
  90. add(1,EBX);
  91. mov(EBX, tabliczka[EAX]);
  92. stdout.put(tabliczka[EAX]:4);
  93. else
  94. mov(0, tabliczka[EAX]);
  95. stdout.put(tabliczka[EAX]:4);
  96.  
  97. endif;
  98. endfor;
  99.  
  100. end zerowanko;
  101.  
  102.  
  103. begin procedurki;
  104. mov(1,EBX);
  105.  
  106. for(mov(i,EAX); i<256; inc(i)) do
  107. mov(EBX, tabliczka[EAX]);
  108. stdout.put(tabliczka[EAX]:4);
  109. add(1,EBX);
  110. endfor;
  111.  
  112. zerowanko();
  113.  
  114. end procedurki;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement