Untitled

From Aufg2, 13 Years ago, written in Plain Text, viewed 3 times.
URL https://paste.blessuren.de/view/af8412a7 Embed
Download Paste or View Raw
  1. #define N 100
  2. byte x=0;
  3. proctype P1(){ 
  4.         x=x+1;
  5.         x=x+1
  6. }
  7. proctype P2(){
  8.         x=2
  9. }
  10.  
  11. proctype ueberlauf() {
  12.         byte y = 0;
  13.  
  14.         x = 0;
  15.         x = x-1;
  16.        
  17.         x = 254;
  18.         x = x+1;
  19.         x = x+1;
  20. }      
  21.  
  22. active proctype zufall() {
  23.         do
  24.         :: x % 10 != 9 -> x = x + 1;
  25.         :: x % 10 == 9 && x != 99 ->  x = x +2;
  26.         :: break;
  27.         od
  28.  
  29. }      
  30.  
  31.  
  32. /* Aufgabe 1a: Werte 2 und 4 sind möglich */
  33. /* Aufgabe 1b: Es wird eine Fehlermeldung ausgegeben:
  34.           1:    proc  0 (ueberlauf) aufg1.pml:13 (state 1)      [x = 0]
  35.           spin: aufg1.pml:14, Error: value (-1->255 (8)) truncated in assignment
  36.           2:    proc  0 (ueberlauf) aufg1.pml:14 (state 2)      [x = (x-1)]
  37.           3:    proc  0 (ueberlauf) aufg1.pml:16 (state 3)      [x = 254]
  38.           4:    proc  0 (ueberlauf) aufg1.pml:17 (state 4)      [x = (x+1)]
  39.           spin: aufg1.pml:18, Error: value (256->0 (8)) truncated in assignment
  40.           5:    proc  0 (ueberlauf) aufg1.pml:18 (state 5)      [x = (x+1)]
  41. */
  42. /* Aufgabe 1c: */
  43.  

Reply to "Untitled"

Here you can reply to the paste above