Programlama | Programlama Dilleri | C Programlama Dili |C++

Hata
  • XML Parsing Error at 1:82. Error 9: Invalid character
Anasayfa Programlama C / C++ Selection Sort (Dizi S?ralama)


Selection Sort (Dizi S?ralama)

AÇIKLAMA

Selection sort algoritmas?na göre klavyeden girilen de?i?ken say?daki say?lar? s?ralayan programd?r.

Program C++ kodunda olup üst seviye dillerde de çal???r.

Program?n Tamam?n? A?a??daki Linkten ?ndirebilirsiniz

Linki Görebilmeniz ?çin Üye Olman?z Gerekmektedir...

Üye Kay?t

Program Kodu:

//---------------------------------------------------------------------------
 
#include <vcl.h>
#pragma hdrstop
#include <conio.h>
#include <stdio.h>
#include <iostream.h>
 
//---------------------------------------------------------------------------
 
#pragma argsused
int main(int argc, char* argv[])
{
int n;
cout<<"Dizinin eleman sayisini girin:" ;
cin>>n;
cout<<endl;
DynamicArray <int> ar;
ar.Length=n;
for (int i=0;i<n; i++)
{
cout<<"Dizinin ";
cout<<(i+1);
cout<<".elemanini gir: ";
cin>> ar[i];
cout<<endl;
}
 
int i = 0;
 
    while (i < n) {
        if (i == 0 || ar[i-1] <= ar[i]) i++;
        else {int tmp = ar[i]; ar[i] = ar[i-1]; ar[--i] = tmp;}
    }
for(int i=0;i<n;i++)
printf("%d\n",ar[i]);
getche();
        return 0;
}
 
 
 

Yorumlar (0)
Sadece kayıtlı kullanıcılar yorum yazabilir!
Son Güncelleme ( Perşembe, 26 Nisan 2012 17:46 )  
404 Not Found

404

Not Found

The resource requested could not be found on this server!


Proudly powered by LiteSpeed Web Server

Please be advised that LiteSpeed Technologies Inc. is not a web hosting company and, as such, has no control over content found on this site.