Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _4_3
- {
- class Program
- {
- static void Main(string[] args)
- {
- ReadInt();
- }
- static void ReadInt()
- {
- string str = Console.ReadLine();
- int number;
- bool converted = int.TryParse(str, out number);
- while (converted == false)
- {
- converted = int.TryParse(str, out number);
- if(!converted)
- {
- Console.WriteLine("Ошибка конвертации '{0}'", str);
- str = Console.ReadLine();
- }
- }
- Console.WriteLine("Преобразован '{0}' в {1}.", str, number);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement