|
|
|
|
#include<stdbool.h>
|
|
|
|
|
#include<limits.h>
|
|
|
|
|
#include<math.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<conio.h>
|
|
|
|
|
#include<Windows.h>
|
|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int counts = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*<2A>ṹ<EFBFBD>嶨<EFBFBD><E5B6A8>*/
|
|
|
|
|
typedef struct student {
|
|
|
|
|
char no[21];
|
|
|
|
|
char name[11];
|
|
|
|
|
bool fame;
|
|
|
|
|
unsigned short int age;
|
|
|
|
|
char oth[151];
|
|
|
|
|
struct student * next;
|
|
|
|
|
}student;
|
|
|
|
|
|
|
|
|
|
struct student * first = NULL;//<2F><>һ<EFBFBD><D2BB>
|
|
|
|
|
struct student * loc = NULL;//<2F><>ǰ(һ<><D2BB>ΪNULL)
|
|
|
|
|
|
|
|
|
|
void input(void);//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
void print(void);//<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|
|
|
|
void print_1(const student *);//<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|
|
|
|
void creat(const student);//<2F><><EFBFBD>쵥<EFBFBD><ECB5A5>
|
|
|
|
|
void save(void);//ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void search_by_sex(bool);//<2F><><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void search_by_age(unsigned short int);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void show_menu(void);//<2F><>ʾ<EFBFBD>˵<EFBFBD>
|
|
|
|
|
void exith(void);//<2F>˳<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
int main() {
|
|
|
|
|
run();
|
|
|
|
|
system("pause");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
void show_menu(void) {
|
|
|
|
|
printf("a.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>\n");
|
|
|
|
|
printf("b.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ʾ\n");
|
|
|
|
|
printf("c.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("d.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣɾ<CFA2><C9BE>\n");
|
|
|
|
|
printf("e.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("f.ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ\n");
|
|
|
|
|
printf("g.<2E>˳<EFBFBD>ϵͳ\n");
|
|
|
|
|
char t = getch();
|
|
|
|
|
switch (t) {
|
|
|
|
|
case 'a':
|
|
|
|
|
input();
|
|
|
|
|
show_menu();
|
|
|
|
|
break;
|
|
|
|
|
case 'b':
|
|
|
|
|
system("cls");
|
|
|
|
|
print();
|
|
|
|
|
system("pause");
|
|
|
|
|
system("cls");
|
|
|
|
|
show_menu();
|
|
|
|
|
break;
|
|
|
|
|
case 'c':
|
|
|
|
|
save();
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
show_menu();
|
|
|
|
|
break;
|
|
|
|
|
case 'd':
|
|
|
|
|
{
|
|
|
|
|
char no_t[21];
|
|
|
|
|
system("cls");
|
|
|
|
|
print();
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:\n");
|
|
|
|
|
while (1) {
|
|
|
|
|
fgets_nn(no_t, 21, stdin);
|
|
|
|
|
if (!strcmp(no_t, "\0")) {
|
|
|
|
|
printf("ѧ<EFBFBD>Ų<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>:\n");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (del(no_t)) {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\n\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!<21><><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD>ѧ<EFBFBD>ŵ<EFBFBD>ѧ<EFBFBD><D1A7>!\n\n");
|
|
|
|
|
}
|
|
|
|
|
show_menu();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'e':
|
|
|
|
|
{
|
|
|
|
|
char no_t[21];
|
|
|
|
|
system("cls");
|
|
|
|
|
if (!check_password()) {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤ʧ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
show_menu();
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|
|
|
|
|
print();
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:\n");
|
|
|
|
|
while (1) {
|
|
|
|
|
fgets_nn(no_t, 21, stdin);
|
|
|
|
|
if (!strcmp(no_t, "\0")) {
|
|
|
|
|
printf("ѧ<EFBFBD>Ų<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>:\n");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (edit(no_t)) {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD>ijɹ<EFBFBD>!\n\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!<21><><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD>ѧ<EFBFBD>ŵ<EFBFBD>ѧ<EFBFBD><D1A7>\n\n");
|
|
|
|
|
}
|
|
|
|
|
show_menu();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'f':
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
char mod;
|
|
|
|
|
while (1) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ:\n");
|
|
|
|
|
printf("(1)<29><>ѧ<EFBFBD>Ų<EFBFBD>ѯ\n");
|
|
|
|
|
printf("(2)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ\n");
|
|
|
|
|
printf("(3)<29><><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ѯ\n");
|
|
|
|
|
printf("(4)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ\n");
|
|
|
|
|
mod = getch();
|
|
|
|
|
if (mod - '0' < 1 || mod - '0'>4) {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (mod - '0') {
|
|
|
|
|
case 1:
|
|
|
|
|
{//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>,<2C><>ֹcase<73>ڶ<EFBFBD><DAB6>屻<EFBFBD><E5B1BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
char tem[21];
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>:\n");
|
|
|
|
|
while (1) {
|
|
|
|
|
fgets_nn(tem, 21, stdin);
|
|
|
|
|
if (!strcmp(tem, "\0")) {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("ѧ<EFBFBD>Ų<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ѯ<EFBFBD><D1AF>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7>:\n");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/*student *ge = search_by_no(tem);
|
|
|
|
|
if (ge == NULL) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD>ѧ<EFBFBD>ŵ<EFBFBD>ѧ<EFBFBD><EFBFBD>!<21><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>Ϊ%s<><73>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n\n", tem);
|
|
|
|
|
print_1(ge);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}*/
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
char name[11];
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
do {
|
|
|
|
|
fgets_nn(name, 11, stdin);
|
|
|
|
|
} while (!strcmp(name, "\0"));
|
|
|
|
|
search_by_name(name);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
bool fame;
|
|
|
|
|
while (1) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>(1.<2E><> 2.Ů):\n");
|
|
|
|
|
char t = getch();
|
|
|
|
|
if (t == '1') {
|
|
|
|
|
fame = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (t == '2') {
|
|
|
|
|
fame = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EFBFBD>ȷ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD>Ա<EFBFBD>(1.<2E><> 2.Ů):\n");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
search_by_sex(fame);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
unsigned short int age;
|
|
|
|
|
while (1) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
if (scanf("%hd", &age) != 1) {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EFBFBD>ȷ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
while (getchar() != '\n')continue;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
search_by_age(age);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
system("pause");
|
|
|
|
|
system("cls");
|
|
|
|
|
show_menu();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'g':
|
|
|
|
|
save();
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>ϵͳ!\n");
|
|
|
|
|
exith();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n\n");
|
|
|
|
|
show_menu();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void input(void) {
|
|
|
|
|
student temp;
|
|
|
|
|
char t;
|
|
|
|
|
while (1) {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>,<2C>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӻس<D3BB>:\n");
|
|
|
|
|
while (1) {
|
|
|
|
|
fgets_nn(temp.no, 21, stdin);
|
|
|
|
|
if (!check_no(temp.no))
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!strcmp(temp.no, "\0")) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
do {
|
|
|
|
|
fgets_nn(temp.name, 11, stdin);
|
|
|
|
|
} while (!strcmp(temp.name, "\0"));
|
|
|
|
|
while (1) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>(1.<2E><> 2.Ů):\n");
|
|
|
|
|
t = getch();
|
|
|
|
|
if (t == '1') {
|
|
|
|
|
temp.fame = true;
|
|
|
|
|
printf("<EFBFBD><EFBFBD>\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (t == '2') {
|
|
|
|
|
temp.fame = false;
|
|
|
|
|
printf("Ů\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EFBFBD>ȷ\n");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (1) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
if (scanf("%hd", &temp.age) != 1) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>벻<EFBFBD><EFBFBD>ȷ\n");
|
|
|
|
|
while (getchar() != '\n')continue;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ע:\n");
|
|
|
|
|
while (getchar() != '\n')continue;
|
|
|
|
|
fgets_nn(temp.oth, 151, stdin);
|
|
|
|
|
creat(temp);
|
|
|
|
|
system("pause");
|
|
|
|
|
counts++;
|
|
|
|
|
save();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void creat(const student t) {
|
|
|
|
|
if (first == NULL) {
|
|
|
|
|
first = (student*)malloc(sizeof(student));
|
|
|
|
|
loc = first;
|
|
|
|
|
first->next = NULL;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
loc->next= (student*)malloc(sizeof(student));
|
|
|
|
|
loc = loc->next;
|
|
|
|
|
loc->next = NULL;
|
|
|
|
|
}
|
|
|
|
|
loc->age = t.age;
|
|
|
|
|
loc->fame = t.fame;
|
|
|
|
|
int i=0;
|
|
|
|
|
for(i=0;i<11&&t.name[i>0?i-1:0]!='\0';i++)
|
|
|
|
|
loc->name[i] = t.name[i];
|
|
|
|
|
for (i = 0; i < 21&&t.no[i > 0 ? i - 1 : 0] != '\0'; i++)
|
|
|
|
|
loc->no[i] = t.no[i];
|
|
|
|
|
for (i = 0; i < 151; i++)
|
|
|
|
|
loc->oth[i] = t.oth[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void print(void) {
|
|
|
|
|
student * l = first;
|
|
|
|
|
printf("ϵͳ<EFBFBD>ڹ<EFBFBD><EFBFBD><EFBFBD>%d<><64>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n\n", counts);
|
|
|
|
|
while (l != NULL) {
|
|
|
|
|
print_1(l);
|
|
|
|
|
printf("\n");
|
|
|
|
|
l = l->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void print_1(const student * t) {
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:%s\n", t->no);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n", t->name);
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD>:%s\n", t->fame ? "<EFBFBD><EFBFBD>": "Ů");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\n", t->age);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ע:%s\n", t->oth);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void exith(void) {
|
|
|
|
|
student *l = first;
|
|
|
|
|
student n;
|
|
|
|
|
while (l != NULL) {
|
|
|
|
|
n = *l;
|
|
|
|
|
free(l);
|
|
|
|
|
l = n.next;
|
|
|
|
|
}
|
|
|
|
|
printf("ϵͳ<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>!\n");
|
|
|
|
|
system("pause");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
void save(void) {
|
|
|
|
|
FILE * data;
|
|
|
|
|
data = fopen("data", "w");
|
|
|
|
|
student * l = first;
|
|
|
|
|
while (l != NULL) {
|
|
|
|
|
fprintf(data, "%s\n", l->no);
|
|
|
|
|
fprintf(data, "%s\n", l->name);
|
|
|
|
|
fprintf(data, "%d\n", l->fame);
|
|
|
|
|
fprintf(data, "%d\n", l->age);
|
|
|
|
|
fprintf(data, "%s\n", l->oth);
|
|
|
|
|
l = l->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(data);
|
|
|
|
|
}
|
|
|
|
|
void search_by_sex(bool fame) {
|
|
|
|
|
student *l = first;
|
|
|
|
|
unsigned int c = 0;
|
|
|
|
|
system("cls");
|
|
|
|
|
while (l != NULL) {
|
|
|
|
|
if (l->fame == fame) {
|
|
|
|
|
print_1(l);
|
|
|
|
|
printf("\n");
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
l = l->next;
|
|
|
|
|
}
|
|
|
|
|
if (c == 0) {
|
|
|
|
|
printf("δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("\n<EFBFBD>Ѽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64><EFBFBD>Ա<EFBFBD>Ϊ%s<><73>ѧ<EFBFBD><D1A7>\n\n", c, fame ? "<EFBFBD><EFBFBD>" : "Ů");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void search_by_age(unsigned short int age) {
|
|
|
|
|
student *l = first;
|
|
|
|
|
unsigned int c = 0;
|
|
|
|
|
system("cls");
|
|
|
|
|
while (l != NULL) {
|
|
|
|
|
if (l->age == age) {
|
|
|
|
|
print_1(l);
|
|
|
|
|
printf("\n");
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
l = l->next;
|
|
|
|
|
}
|
|
|
|
|
if (c == 0) {
|
|
|
|
|
printf("δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("\n<EFBFBD>Ѽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ%d<><64>ѧ<EFBFBD><D1A7>\n\n", c, age);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|