test
This commit is contained in:
parent
177d370b6f
commit
12794efe5f
14
anketa.c
14
anketa.c
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user