From 843d229eedc78ea29c690d8627a9760412eeabb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Cabra?= Date: Fri, 25 Oct 2019 11:02:02 +0000 Subject: [PATCH] Aktualizovat "program.c --- program.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/program.c b/program.c index cfd22d5..8127828 100644 --- a/program.c +++ b/program.c @@ -23,12 +23,24 @@ int compare_pizza(const void * left, const void * right) { return -1; } else{ - if(a->name[0] > b->name[0]){ + i=0; + while(1){ + if(a->name[i]=='\n' || b->name[i]=='\n'){ + break; + } + else if(a->name[i]=='\r' || b->name[i]=='\r'){ + break; + } + + else if(a->name[i] > b->name[i]){ return 1; + } + else{ + i++ + } + } - else{ - return -1; - } + return -1; } }