From 7c15bb5fb2ebceb42097cbb037f304ee5066dff6 Mon Sep 17 00:00:00 2001 From: Oleksandr Hryshchenko Date: Fri, 16 Apr 2021 10:58:46 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'du6/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du6/program.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/du6/program.c b/du6/program.c index b43d1e5..3322f0a 100644 --- a/du6/program.c +++ b/du6/program.c @@ -41,21 +41,7 @@ int main() { } //The code below orders the applicants by name (a-z) - int changesMade = 1; - while(changesMade){ - changesMade = 0; - for(int i = 0; i < finalPosition; i++){ - while(inputs[i][count] == inputs[i + 1][count]) - count++; - if(inputs[i][count] > inputs[i + 1][count]){ - changesMade = 1; - strcpy(temp, inputs[i]); - strcpy(inputs[i], inputs[i + 1]); - strcpy(inputs[i + 1], temp); - } - count = 0; - } - } + qsort(inputs, finalPosition+1, 50*sizeof(char), strcmp); printf("Prijati studenti:\n"); for(int i = 1; i <= freePlaces; i++){