Smith46
@Smith46
Начинающий WEB-developer

Как отсортировать массив?

Сортировка выдает ошибку
Имя типа или пространства имен "Sort" отсутствует в пространстве имен "Array" (пропущена ссылка на сборку?)

using System;
using Array;



namespace Array
{
    class Program
    {
        static void Main()
        {
            int arrSize = 0;

            Console.Write("Введите размер масссива: ");
            arrSize = Convert.ToInt32(Console.ReadLine());

            int[] arrayN = new int[arrSize];
            Random ran = new Random();

            for (int i = 0; i < arrayN.Length; i++)
            {
                arrayN[i] = ran.Next(-500, 500);
                Array.Sort(arrayN[i]); 
                Console.WriteLine(arrayN[i]);
            }
            Console.ReadKey();
        }
    }
}
  • Вопрос задан
  • 152 просмотра
Решения вопроса 1
@Artem_Nim_programmer
Programmer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sort_mass
{
class Program
{
static void Main(string[] args)
{
int[] a = new int[10];
Random r = new Random();
for (int i = 0; i < 10; i++)
{
a[i] = r.Next(10);
Console.Write(a[i]+" ");
}
Console.WriteLine();
Array.Sort(a);
for (int i = 0; i < 10; i++)
Console.Write(a[i] + " ");
Console.ReadKey();
}
}
}
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@tex0
using Array;
лишнее, уберите эту строчку
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы