Consolda Compare Komutu Kullanarak Alfabetik Sıralama

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using yeni = System.Threading.Thread;
namespace ConsoleApplication1
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] Kelime1=new string[5];
            string yed;


            for (int i = 0; i < Kelime1.Length; i++)
            { Console.WriteLine(i+1 +”. Kelimeyi giriniz”);
            Kelime1[i]=Console.ReadLine();
            }
                for (int i = 0; i < Kelime1.Length; i++)
                {
                    for (int j = i + 1; j < Kelime1.Length; j++)
                    {
                        if (String.Compare(Kelime1[i], Kelime1[j]) > 0)
                        {
                            yed = Kelime1[i];
                            Kelime1[i] = Kelime1[j];
                            Kelime1[j] = yed;
                        }
                    }
                }
            for (int i = 0; i < Kelime1.Length; i++)
            { Console.WriteLine(Kelime1[i]); }
                Console.ReadLine();
                        }
                    }
                    
                }

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak.