This commit is contained in:
Michaela Šaková 2019-03-23 20:12:58 +01:00
parent 177d370b6f
commit 12794efe5f
4 changed files with 17 additions and 3 deletions

BIN
anketa

Binary file not shown.

View File

@ -6,7 +6,7 @@
int count_students(struct student* students){
int x=0;
for(int i=0; i<MAXSTUDENTS; i++){
if(students[i].name!=NULL){
if(!(strcmp(students[i].name,"")==0)){
x++;
}
}
@ -62,7 +62,7 @@ void sort_students(struct student* students){
}
void print_students(struct student* students){
for(int i=0;i<MAXSTUDENTS;i++){
for(int i=0;i<count_students(students);i++){
if(students[i].name!=NULL){
printf("%s\n %d\n", students[i].name, students[i].votes);
}
@ -70,6 +70,16 @@ void print_students(struct student* students){
}
void read_students(FILE* file,struct student* students){
char meno[100];
int body;
do{
fscanf(file,"%s",&meno[0]);
fscanf(file,"%d",&body);
if(add_student(students,meno,body)==-1){
break;
}
}while(meno[0]=EOF);
}

BIN
anketa.o

Binary file not shown.

4
vstup.txt Normal file
View File

@ -0,0 +1,4 @@
Anka Lesna
10
Marcel Novotny
30