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 practice9
- {
- class Program
- {
- public static int ReadNatural()
- //ввод числа для красивых лаб
- {
- bool check = false;
- int intNum;
- do
- {
- // Попытка перевести строку в число
- check = Int32.TryParse(Console.ReadLine(), out intNum);
- // Если попытка неудачная:
- if (!check)
- Console.WriteLine("Некорректный ввод. Попробуйте ещё раз");
- } while (!check);
- // Если попытка удачная:
- return intNum;
- }
- static Random rnd = new Random();
- static void Main(string[] args)
- {
- CircleList<int> circleList = new CircleList<int>();
- Console.WriteLine("Введите количество элементов которые необходимо добавить в список");
- int n=ReadNatural();
- for( int i=0; i<n;i++)
- {
- circleList.Add(rnd.Next(-100, 101));
- }
- Node<int> point = new Node<int>(0);
- for (int i = 0; i < circleList.Count; i++)
- {
- Console.Write(point.Data + " ");
- point = point.Next;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement