Aktualizovat a3/program.c
This commit is contained in:
parent
02d81e8573
commit
54dca12376
14
a3/program.c
14
a3/program.c
@ -45,7 +45,7 @@ int main()
|
||||
//helper/pomocne lokalne premeny
|
||||
int studentsAmount = 0;
|
||||
struct studentApplication student[STUDENT_SIZE];
|
||||
int i = 0; //pomocny index
|
||||
int i = 0;
|
||||
char processedName[BUFFER_SIZE];
|
||||
char processedSurname[BUFFER_SIZE];
|
||||
char line[BUFFER_SIZE];
|
||||
@ -60,17 +60,16 @@ int main()
|
||||
{
|
||||
if(sscanf(line, "%d", &studentsAmount) == 1) { continue; }
|
||||
}
|
||||
else if(sscanf(line, " %s %s", processedName, processedSurname) == 2)
|
||||
//pocet vsetkych najdenych mien
|
||||
int foundNamesCount = sscanf(line, " %s %s", processedName, processedSurname);
|
||||
|
||||
if (foundNamesCount > 1)
|
||||
{
|
||||
strcpy(student[i].name, processedName);
|
||||
strcpy(student[i].surname, processedSurname);
|
||||
i++;
|
||||
}
|
||||
else if(sscanf(line, " %s", processedName) == 1)
|
||||
{
|
||||
strcpy(student[i].name, processedName);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (studentsAmount == 0)
|
||||
@ -89,7 +88,6 @@ int main()
|
||||
|
||||
//vykalkuluje realny mozny limit studentov na zaklade nacitanych zaznamov (index premena 'i' = celkovy pocet najdenych studentov)
|
||||
//a celkovom pocte akceptovanych studentov najdenom na prvom riadku (studentsAmount premena) a ano, mam zle pomenovane premeny
|
||||
|
||||
int limit;
|
||||
if (i < studentsAmount)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user