Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace IMJunior
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Введите строку:");
- string input = Console.ReadLine();
- TryParse(0,ref input);
- }
- static void TryParse(int number, ref string input )
- {
- while (true)
- {
- bool result = int.TryParse(input, out number);
- if (result == true)
- {
- Console.WriteLine("Преобразование прошло успешно");
- break;
- }
- else
- {
- Console.WriteLine("Хтьфу");
- }
- input = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment