Advertisement
salron3

111

Apr 3rd, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. int fsm(int c, int status) // търсим '111' във файла
  2. {
  3.     if (status == 3)
  4.     {
  5.         status = 0;
  6.     }
  7.  
  8.     switch (status)
  9.     {
  10.     case 0:
  11.         if (c == '1')
  12.             status = 1;
  13.         break;
  14.     case 1:
  15.         if (c == '1')
  16.         {
  17.             status = 2;
  18.         }
  19.         else
  20.         {
  21.             status = 0;
  22.         }
  23.         break;
  24.     case 2:
  25.         if (c == '1')
  26.         {
  27.             status = 3;
  28.         }
  29.         else
  30.         {
  31.             status = 0;
  32.         }
  33.         break;
  34.     }
  35.     return status;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement