asda
This commit is contained in:
parent
f7c0978ec3
commit
8cca7f686e
BIN
du4/program
BIN
du4/program
Binary file not shown.
@ -22,7 +22,8 @@ int main() {
|
||||
}
|
||||
|
||||
if (i == studentCount) {
|
||||
strcpy(listM[studentCount], aMeno);
|
||||
strncpy(listM[studentCount], aMeno, sizeof(listM[studentCount]) - 1);
|
||||
listM[studentCount][sizeof(listM[studentCount]) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
||||
listH[studentCount] = aHlasy;
|
||||
studentCount++;
|
||||
}
|
||||
@ -41,15 +42,21 @@ int main() {
|
||||
listH[j + 1] = docasneHlasy;
|
||||
|
||||
char docasneMeno[20];
|
||||
strcpy(docasneMeno, listM[j]);
|
||||
strcpy(listM[j], listM[j + 1]);
|
||||
strcpy(listM[j + 1], docasneMeno);
|
||||
strncpy(docasneMeno, listM[j], sizeof(docasneMeno) - 1);
|
||||
docasneMeno[sizeof(docasneMeno) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
||||
strncpy(listM[j], listM[j + 1], sizeof(listM[j]) - 1);
|
||||
listM[j][sizeof(listM[j]) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
||||
strncpy(listM[j + 1], docasneMeno, sizeof(listM[j + 1]) - 1);
|
||||
listM[j + 1][sizeof(listM[j + 1]) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
||||
}
|
||||
else if (listH[j] == listH[j + 1] && strcmp(listM[j], listM[j + 1]) > 0) {
|
||||
char docasneMeno[20];
|
||||
strcpy(docasneMeno, listM[j]);
|
||||
strcpy(listM[j], listM[j + 1]);
|
||||
strcpy(listM[j + 1], docasneMeno);
|
||||
strncpy(docasneMeno, listM[j], sizeof(docasneMeno) - 1);
|
||||
docasneMeno[sizeof(docasneMeno) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
||||
strncpy(listM[j], listM[j + 1], sizeof(listM[j]) - 1);
|
||||
listM[j][sizeof(listM[j]) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
||||
strncpy(listM[j + 1], docasneMeno, sizeof(listM[j + 1]) - 1);
|
||||
listM[j + 1][sizeof(listM[j + 1]) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user