You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.7 KiB

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct time
{
int hour;
int min;
};
struct STUDENT
{
char NO[20];
char CLASS[20];
char NAME[20];
int time_hour;
int time_min;
struct time begin,end;
};
struct STUDENT stu[30];
static int i=0;
void insert();
void findCLASS();
void findNO();
void findNAME();
void money();
void add_student();
void del_student();
void addfile();
void show();
int main()
{
int i;
for(;;)
{
printf("\t\t\t*********************\n");
printf("\t\t\t MENU \n");
printf("\t\t\t1 Type stu info\n");
printf("\t\t\t2 serch by stu NO\n");
printf("\t\t\t3 serch by CLASS\n");
printf("\t\t\t4 serch by NAME\n");
printf("\t\t\t5 Pay Money\n");
printf("\t\t\t6 add student\n");
printf("\t\t\t7 delete student\n");
printf("\t\t\t8 add to file\n");
printf("\t\t\t9 show file\n");
printf("\t\t\t10 Close system");
printf("\n\n\n\t\t\tPlease type what u want:\n\n\t\t\t");
scanf("%d",&i);
switch(i)
{
case 1:
{
system("cls");
insert();
}break;
case 2:
{
system("cls");
findNO();
}break;
case 3:
{
system("cls");
findCLASS();
} break;
case 4:
{
system("cls");
findNAME();
}break;
case 5:
{system("cls");
money();
}break;
case 6:
{
system("cls");
add_student();
}break;
case 7:
{
system("cls");
del_student();
}break;
case 8:
{
system("cls");
addfile();
}break;
case 9:
{
return 0;
}
}
}
system("pause") ;
return 0;
}
void insert()
{
printf("please type stu NO:\n");
scanf("%s",&stu[i].NO);
printf("please type stu CLASS:\n");
scanf("%s",&stu[i].CLASS);
printf("please type stu NAME:\n");
scanf("%s",&stu[i].NAME);
printf("please type begin time:\n");
scanf("%d:%d",&stu[i].begin.hour,&stu[i].begin.min);
i=i+1;
/* FILE *fp;
int j;
fp=fopen("jifang.txt","wb");
for(j=0;j<i-1;j++)
fwrite(&stu[j], sizeof(struct STUDENT),1,fp);
fclose(fp);*/
system("pause");
system("cls");
}