SHARE
TWEET

Untitled

SLENSER May 22nd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace _4_3
  2. {
  3.     class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             ReadInt();
  8.         }
  9.         static void ReadInt()
  10.         {
  11.             string str = Console.ReadLine();
  12.             int number;
  13.  
  14.             bool converted = int.TryParse(str, out number);
  15.             while (converted == false)
  16.             {
  17.                 converted = int.TryParse(str, out number);
  18.  
  19.                 if(!converted)
  20.                 {
  21.                     Console.WriteLine("Ошибка конвертации '{0}'", str);
  22.                     str = Console.ReadLine();
  23.                 }
  24.             }
  25.             Console.WriteLine("Преобразован '{0}' в {1}.", str, number);
  26.  
  27.         }
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top