Aktualizovat du2/program.c
This commit is contained in:
parent
25dc8c1eef
commit
5ac6d15ac4
@ -17,7 +17,7 @@ int main() {
|
||||
|
||||
//citanie vstupu
|
||||
char line[SIZE];
|
||||
memset(line,0, sizeof(line));
|
||||
memset(line,0, sizeof(name));
|
||||
char* r = fgets(line,SIZE,stdin);
|
||||
|
||||
if (r == NULL)
|
||||
@ -33,7 +33,7 @@ int main() {
|
||||
struct student DBStudenti[20];
|
||||
|
||||
//prednastavenie pamati
|
||||
memset(student, 0, sizeof(student));
|
||||
memset(DBStudenti, 0, sizeof(DBStudenti));
|
||||
|
||||
//pomocny index
|
||||
int x = 0;
|
||||
@ -44,7 +44,7 @@ int main() {
|
||||
// DBStudenti[x].meno = najdMeno;
|
||||
// DBStudenti[x].pocetHlasov = najdPocetHlasov;
|
||||
strcpy(DBStudenti[x].meno, najdMeno);
|
||||
strcpy(DBStudenti[x].pocetHlasov, najdPocetHlasov);
|
||||
DBStudenti[x].pocetHlasov = najdPocetHlasov;
|
||||
x += 1;
|
||||
|
||||
//reset nacitanych hodnot na konci kazdeho cyklu
|
||||
@ -52,7 +52,7 @@ int main() {
|
||||
najdPocetHlasov = 0;
|
||||
}
|
||||
|
||||
//zoradenie zoznamu, resp. array-u
|
||||
//zoradenie zoznamu, resp. arrayu
|
||||
qsort(DBStudenti, 20, sizeof(struct student), compare);
|
||||
|
||||
//vypis vysledkov
|
||||
@ -61,13 +61,13 @@ int main() {
|
||||
{
|
||||
//20 je nahodne cislo, resp. realne budeme vypisovat userov
|
||||
//, pokial nenarazime na prazdny student ID zaznam
|
||||
if (DBStudenti[i].meno == '\0')
|
||||
if (DBStudent[i].meno == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
//malo by vypisovat zaznamy takto:
|
||||
//10_Tomas_Vlcek
|
||||
printf("%d %s", DBStudenti[i].pocetHlasov, DBStudenti[i].meno);
|
||||
printf("%d %s", DBStudent[i].pocetHlasov, DBStudent[i].meno);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user