boze
This commit is contained in:
parent
ea244bb683
commit
3d81a3cb37
@ -21,30 +21,42 @@ int main(){
|
||||
int counter=0;
|
||||
//char line[LINE_SIZE];
|
||||
//memset(line,0,LINE_SIZE);
|
||||
|
||||
|
||||
struct pizza item;
|
||||
while(read_pizza(&item)){
|
||||
strcpy(jedalny_listok[counter].name, item.name);
|
||||
jedalny_listok[counter].prize=item.prize;
|
||||
counter += 1;
|
||||
//printf("%d\n",counter);
|
||||
if (counter>=POCET_JEDAL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<counter-1;i++){
|
||||
for(int j=0;j<counter-i;j++){
|
||||
if(j<counter-1-i){
|
||||
if(jedalny_listok[j].prize>jedalny_listok[j+1].prize){
|
||||
struct pizza temp=jedalny_listok[j];
|
||||
jedalny_listok[j]=jedalny_listok[j+1];
|
||||
jedalny_listok[j+1]=temp;
|
||||
}
|
||||
else if (jedalny_listok[j].prize==jedalny_listok[j+1].prize){
|
||||
if(strcmp(jedalny_listok[j].name,jedalny_listok[j+1].name)>0){
|
||||
struct pizza temp=jedalny_listok[j];
|
||||
jedalny_listok[j]=jedalny_listok[j+1];
|
||||
jedalny_listok[j+1]=temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i=0;i<counter;i++){
|
||||
//if(search_string(jedalny_listok[i].name,line)!=-1){
|
||||
printf("%s\n",jedalny_listok[i].name);
|
||||
printf("%.2f\n",jedalny_listok[i].prize);
|
||||
//printf("daco\n");
|
||||
//}
|
||||
}
|
||||
//printf("%s",line);
|
||||
//printf("Nacitanych %d poloziek.\n",counter);
|
||||
}
|
||||
|
||||
}
|
||||
void trim(char* str){
|
||||
int i=0;
|
||||
while(str[i]!='\n'&&str[i]!=0){
|
||||
|
BIN
cv2/program.exe
BIN
cv2/program.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user