Guest User

Untitled

a guest
Oct 16th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Ejercicio3
  8. {
  9. class Program
  10. {
  11. enum direcion { arriba = 1, abajo = 3, derecha = 2, izquieda = 4,
  12. abajoDerecha=23, abajoIzquierda=34,arribaDerecha=12,arribaIzquieda=14,
  13. prohibido };
  14. static void Main(string[] args)
  15. {
  16. string num = "";
  17. Console.WriteLine("Escribe la direcion que desees tomar");
  18. num = Console.ReadLine();
  19. string[] array = num.Split(',');
  20.  
  21. for (int i = 0; i < array.Length; i++)
  22. {
  23. if (array[i].Length==2)
  24. {
  25. var a=int.Parse(array[i].Substring(0, 1));
  26. var b=int.Parse(array[i].Substring(1,2));
  27. {
  28. if (a < b)
  29. {
  30. array[i].Reverse;
  31. }
  32.  
  33. }
  34. }
  35. Console.WriteLine("{0}", (direcion)int.Parse(array[i]));
  36. }
  37.  
  38. }
  39. }
  40. }
Add Comment
Please, Sign In to add comment