C语言项目--教师信息/学生成绩管理系统
这个系统实现两个功能,分别是管理教师的信息和学生的成绩,用户可以选择切换实现相应的功能。话不多说了,现在看下程序的实现截图:
下面贴出部分代码:
[cpp]
void add_tea(Teacher tea[])
{
int i=0,j,num;
char str[5];
if(numtea!=0)
{
printf("cover the current record?(y/n)\n");
gets(str);
if(str[0]=='Y'||str[0]=='y')
i=0;
else i=numtea;
}
printf("Please input the number of you add the teachers:");
scanf("%d",&num);
if(i==0)
numtea=num;
else numtea+=num;
if(numtea>lens)
{
lens+=10;
tea=(Teacher *)realloc(tea,lens*SIZE);
}
printf("Please input the teacher's info:\n");
for(;i<numtea;i++)
{
getchar();
printf("please input the teacher's NO.:");
gets(tea[i].number);
printf("please input the teacher's name:");
gets(tea[i].name);
printf("please input the teacher's 易做图(man/woman 0/1):");
gets(tea[i].易做图);
if(tea[i].易做图[0]=='0') strcpy(tea[i].易做图,"man");
else strcpy(tea[i].易做图,"woman");
printf("please input the teacher's address:");
gets(tea[i].addr);
printf("the teacher is married(No/Yes 0/1):");
gets(tea[i].married);
if(tea[i].易做图[0]=='0') strcpy(tea[i].易做图,"No");
else strcpy(tea[i].易做图,"Yes");
}
display_tea(tea,0,numtea-1);
getchar();
}
void display_tea(Teacher tea[],int n1,int n2)
{
int i;
char str[2];
if(numtea==0){
printf("There is Nothing!\n");
printf("Do you want to open some file to find the record?(Y/N)\n");
gets(str);
if (str[0]=='Y'||str[0]=='y')
{
openfileTXT(tea);
}
else
{
return;
}
}
else
{
for(i=n1;i<=n2;i++)
printf("number:%s\tname:%s\t\t易做图:%s\t\taddr:%s\t\tmarried:%s\t",tea[i].number,tea[i].name,tea[i].易做图,tea[i].addr,tea[i].married);
}
}
void adjust(Teacher tea[])
{
char str[5];
int i=-1,j;
if(numtea==0)
{
printf("there is nothing !!!\n");
return;
}
while(i<0)
{
i=find_tea(tea);
if(i>=0)
{
printf("Delete it?(y/n)");
gets(str);
if(str[0]=='y'||str[0]=='Y')
{
delete_tea(tea,i);
/*count(stud); */
}
else
{
printf("Adjust it?(y/n)");
gets(str);
if(str[0]=='y'||str[0]=='Y')
{
补充:软件开发 , C语言 ,