#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NUM_SUBJECTS 5
enum Subject {
MATH, SCIENCE, ENGLISH, HISTORY, PROGRAMMING
};
struct Student {
char name[50];
enum Subject subjects[NUM_SUBJECTS];
float grades[NUM_SUBJECTS];
struct Student *next;
};
// ... ฟังก์ชันอื่นๆ (createNode, addNode, printList, freeList)
int main() {
// ... โค้ดเดิม
// เช่น เพิ่มฟังก์ชันค้นหาข้อมูลนักเรียนตามชื่อ
struct Student* findStudent(struct Student* head, const char* name) {
struct Student* current = head;
while (current != NULL) {
if (strcmp(current
->name
, name
) == 0) { return current;
}
current = current->next;
}
return NULL;
}
// ...
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKI2RlZmluZSBOVU1fU1VCSkVDVFMgNQoKZW51bSBTdWJqZWN0IHsKICAgIE1BVEgsIFNDSUVOQ0UsIEVOR0xJU0gsIEhJU1RPUlksIFBST0dSQU1NSU5HCn07CgpzdHJ1Y3QgU3R1ZGVudCB7CiAgICBjaGFyIG5hbWVbNTBdOwogICAgZW51bSBTdWJqZWN0IHN1YmplY3RzW05VTV9TVUJKRUNUU107CiAgICBmbG9hdCBncmFkZXNbTlVNX1NVQkpFQ1RTXTsKICAgIHN0cnVjdCBTdHVkZW50ICpuZXh0Owp9OwoKLy8gLi4uIOC4n+C4seC4h+C4geC5jOC4iuC4seC4meC4reC4t+C5iOC4meC5hiAoY3JlYXRlTm9kZSwgYWRkTm9kZSwgcHJpbnRMaXN0LCBmcmVlTGlzdCkKCmludCBtYWluKCkgewogICAgLy8gLi4uIOC5guC4hOC5ieC4lOC5gOC4lOC4tOC4oQoKICAgIC8vIOC5gOC4iuC5iOC4mSDguYDguJ7guLTguYjguKHguJ/guLHguIfguIHguYzguIrguLHguJnguITguYnguJnguKvguLLguILguYnguK3guKHguLnguKXguJnguLHguIHguYDguKPguLXguKLguJnguJXguLLguKHguIrguLfguYjguK0KICAgIHN0cnVjdCBTdHVkZW50KiBmaW5kU3R1ZGVudChzdHJ1Y3QgU3R1ZGVudCogaGVhZCwgY29uc3QgY2hhciogbmFtZSkgewogICAgICAgIHN0cnVjdCBTdHVkZW50KiBjdXJyZW50ID0gaGVhZDsKICAgICAgICB3aGlsZSAoY3VycmVudCAhPSBOVUxMKSB7CiAgICAgICAgICAgIGlmIChzdHJjbXAoY3VycmVudC0+bmFtZSwgbmFtZSkgPT0gMCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGN1cnJlbnQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY3VycmVudCA9IGN1cnJlbnQtPm5leHQ7CiAgICAgICAgfQogICAgICAgIHJldHVybiBOVUxMOwogICAgfQoKICAgIC8vIC4uLgp9Cg==