Advertisement
vvsvvs

Untitled

May 20th, 2022
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1.             int row = 2;
  2.             int col = 3;
  3.  
  4.             while (command != "end")
  5.             {
  6.                 int stepRow = 0;
  7.                 int stepCol = 0;
  8.  
  9.                 switch (command)
  10.                 {
  11.                     case "left":
  12.                         colStep--;
  13.                         break;
  14.                     case "right":
  15.                         colStep++;
  16.                         break;
  17.                     case "up":
  18.                         rowStep--;
  19.                         break;
  20.                     case "down":
  21.                         rowStep++;
  22.                         break;
  23.                     default:
  24.                         break;
  25.                 }
  26.  
  27.                 int newRow = row + stepRow;
  28.                 int newCol = col + stepCol;
  29.  
  30.                 // TODO: Изпълнение логиката на задачата
  31.  
  32.                 row = newRow;
  33.                 col = newCol;
  34.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement