37 lines
734 B
C
37 lines
734 B
C
#include <stdio.h>
|
|
#include <ctype.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
typedef struct {
|
|
char name[100];
|
|
int golosa;
|
|
} nameandgolosa;
|
|
|
|
#define MAX_STUDENTS 1000;
|
|
|
|
int najtistudenta (nameandgolosa students[], int count, const char* name) {
|
|
for (int i = 0; i < count; i++) {
|
|
if (strcmp(students[i].name, name) == 0) {
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
int compare (const void* a, const void* b) {
|
|
nameandgolosa* studentA = (nameandgolosa*)a;
|
|
nameandgolosa* studentB = (nameandgolosa*)b;
|
|
|
|
if (studentA->golosa != studentB->golosa) {
|
|
return studentB->golosa - studentA->golosa;
|
|
}
|
|
return strcmp(studentA->name, studentB->name);
|
|
}
|
|
|
|
|
|
int main() {
|
|
return 0;
|
|
}
|
|
|