i
bo„lsa,
i++
va 3-qadamga o„tamiz.
5.
Natijaviy saralangan massivni ekranga chiqaramiz.
Dastur kodi
120
#include
#include
using namespace std;
int main(int args, char *argv[])
{
int n; cout<<"talabalar sonini kiriting=";cin>>n;
struct table{
int t;
char FIO[20];
} talaba[n];
cout<
for(int i=0;i
talaba[i].t=i+1;
cin>>talaba[i].FIO;
}
int l=0;
for(int i=0;i
for(int j=n-1;j>i;j--){
if (strcmp(talaba[j-1].FIO,talaba[j].FIO)==1){
l++;
table k=talaba[j];
talaba[j]=talaba[j-1];
talaba[j-1]=k;
}
}
}
for(int i=0;i
cout<<"| "<
cout<<"bu algoritm jadvalni "<
o‘rinlashtirishda
saraladi\n";
121
system("PAUSE");
}
Do'stlaringiz bilan baham: |