asdaa
This commit is contained in:
parent
8cca7f686e
commit
ccb3d3db06
BIN
du4/program
BIN
du4/program
Binary file not shown.
@ -2,11 +2,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char listM[20][20];
|
char listM[50][50];
|
||||||
int listH[50];
|
int listH[1000];
|
||||||
int studentCount = 0;
|
int studentCount = 0;
|
||||||
int aHlasy;
|
int aHlasy;
|
||||||
char aMeno[30];
|
char aMeno[50];
|
||||||
|
|
||||||
while (scanf("%d", &aHlasy) == 1) {
|
while (scanf("%d", &aHlasy) == 1) {
|
||||||
getchar();
|
getchar();
|
||||||
@ -23,8 +23,7 @@ int main() {
|
|||||||
|
|
||||||
if (i == studentCount) {
|
if (i == studentCount) {
|
||||||
strncpy(listM[studentCount], aMeno, sizeof(listM[studentCount]) - 1);
|
strncpy(listM[studentCount], aMeno, sizeof(listM[studentCount]) - 1);
|
||||||
listM[studentCount][sizeof(listM[studentCount]) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
listM[studentCount][sizeof(listM[studentCount]) - 1] = '\0'; listH[studentCount] = aHlasy;
|
||||||
listH[studentCount] = aHlasy;
|
|
||||||
studentCount++;
|
studentCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,22 +40,22 @@ int main() {
|
|||||||
listH[j] = listH[j + 1];
|
listH[j] = listH[j + 1];
|
||||||
listH[j + 1] = docasneHlasy;
|
listH[j + 1] = docasneHlasy;
|
||||||
|
|
||||||
char docasneMeno[20];
|
char docasneMeno[50];
|
||||||
strncpy(docasneMeno, listM[j], sizeof(docasneMeno) - 1);
|
strncpy(docasneMeno, listM[j], sizeof(docasneMeno) - 1);
|
||||||
docasneMeno[sizeof(docasneMeno) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
docasneMeno[sizeof(docasneMeno) - 1] = '\0';
|
||||||
strncpy(listM[j], listM[j + 1], sizeof(listM[j]) - 1);
|
strncpy(listM[j], listM[j + 1], sizeof(listM[j]) - 1);
|
||||||
listM[j][sizeof(listM[j]) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
listM[j][sizeof(listM[j]) - 1] = '\0';
|
||||||
strncpy(listM[j + 1], docasneMeno, sizeof(listM[j + 1]) - 1);
|
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
|
listM[j + 1][sizeof(listM[j + 1]) - 1] = '\0';
|
||||||
}
|
}
|
||||||
else if (listH[j] == listH[j + 1] && strcmp(listM[j], listM[j + 1]) > 0) {
|
else if (listH[j] == listH[j + 1] && strcmp(listM[j], listM[j + 1]) > 0) {
|
||||||
char docasneMeno[20];
|
char docasneMeno[50];
|
||||||
strncpy(docasneMeno, listM[j], sizeof(docasneMeno) - 1);
|
strncpy(docasneMeno, listM[j], sizeof(docasneMeno) - 1);
|
||||||
docasneMeno[sizeof(docasneMeno) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
docasneMeno[sizeof(docasneMeno) - 1] = '\0';
|
||||||
strncpy(listM[j], listM[j + 1], sizeof(listM[j]) - 1);
|
strncpy(listM[j], listM[j + 1], sizeof(listM[j]) - 1);
|
||||||
listM[j][sizeof(listM[j]) - 1] = '\0'; // zabezpečenie ukončenia reťazca
|
listM[j][sizeof(listM[j]) - 1] = '\0';
|
||||||
strncpy(listM[j + 1], docasneMeno, sizeof(listM[j + 1]) - 1);
|
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
|
listM[j + 1][sizeof(listM[j + 1]) - 1] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user