lolblach333

Untitled

Apr 16th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System;
  2.  
  3. namespace IMJunior
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. Console.WriteLine("Введите строку:");
  10. string input = Console.ReadLine();
  11. TryParse(0,ref input);
  12.  
  13.  
  14. }
  15. static void TryParse(int number, ref string input )
  16. {
  17.  
  18.  
  19. while (true)
  20. {
  21. bool result = int.TryParse(input, out number);
  22.  
  23. if (result == true)
  24. {
  25. Console.WriteLine("Преобразование прошло успешно");
  26. break;
  27. }
  28. else
  29. {
  30. Console.WriteLine("Хтьфу");
  31. }
  32. input = Console.ReadLine();
  33.  
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment