2- Mustaqil ish.
Mavzu:Qidirish va saralash algoritmlari.
10-Variant.
A massive qiymatlarini pufaksimon saralash algoritmidan foydalanib o’sosh tartibida saralab, eng
Kichkina magnify elementlarini ekranga chiqazuvchi dastur tuzing.
#include
#include
#include
using namespace std;
int main(){
srand(time_t(NULL));
short n;
cout<<"Elementlar soni: "; cin>>n;
short i; int a[50];
for (i=0; ia[i]=rand()%101-50;
for (i=0; icout<<"a["<cout<for (i=0; ifor (short j=0; jif (a[j]>a[j+1]) swap(a[j],a[j+1]);
}
}
cout<<"(Bubble sort)da saralangan massiv elementlari."<for (i=0; icout<cout<cout<<"Massivning eng kichik manfiy elementi: "<return 0;
}
Do'stlaringiz bilan baham: |