Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp51
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a = 0;
- verify(ref a);
- Console.WriteLine("Ура вы смогли ввести число. Вы просто умничка:)");
- Console.WriteLine("Ваше писло: "+a);
- Console.ReadLine();
- }
- static void verify(ref int a)
- {
- string ageRaw = string.Empty;
- Console.WriteLine("Введите число!");
- do
- {
- ageRaw = Console.ReadLine();
- Console.Clear();
- if (int.TryParse(ageRaw, out a))
- {
- break;
- }
- else
- {
- Console.WriteLine("Вы ввели не число. Попробуйте ещё раз!");
- }
- } while (true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement