设为首页 加入收藏

TOP

C语言项目--教师信息/学生成绩管理系统
2014-11-23 22:04:09 来源: 作者: 【 】 浏览:0
Tags:语言 项目 教师 信息 学生 成绩 管理系统
\

\


\


\


\


  下面贴出部分代码:
  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=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') 
    { 

     printf("Please input something you want:\n"); 
     printf("please input the teacher's NO.:"); 
     gets(tea.number); 
     printf("please input the teacher's name:"); 
     gets(tea.name); 
     printf("please input the teacher's sex(man/woman 0/1):"); 
     gets(tea.sex); 
     if(tea.sex[0]=='0') strcpy(tea.sex,"man"); 
     else strcpy(tea.sex,"woman"); 
     printf("please input the teacher's address:"); 
     gets(tea.addr); 
     printf("the teacher is married(No/Yes 0/1):"); 
     gets(tea.married); 
     if(tea.sex[0]=='0') strcpy(tea.sex,"No"); 
     else strcpy(tea.sex,"Yes"); 
    } 
    /*count(stud); */
   } 
   display_tea(tea,0,numtea-1); 
  } 
  printf("Again to Adjust it  (y/n)\n"); 
  gets(str); 
  if(str[0]=='y'||str[0]=='Y') 
   i=-1; 
  else i=1; 
} 
} 

int find_tea(Teacher tea[]) 
{ 
char str[10]; 
int i; 
if(numtea==0) 
{ 
  printf("There is nothing\n"); 
  return -1; 
} 
else 
{ 
  printf("what do you want your fashion  \n1.number\t2.name\t3.addr\n"); 
  gets(str); 
  if(str[0]=='1') 
  { 
   printf("please input the teacher's number:"); 
   gets(str); 
   for(i=0;i<=numtea;i++) 
    if(strcmp(str,tea.number)==0) 
    { 
     display_tea(tea,i,i); 
     break; 
    } 
    else continue; 
  } 
  else if(str[0]=='2') 
  { 
   printf("please input the teacher's name:"); 
   gets(str); 
   for(i=0;i<=numtea;i++) 
    if(strcmp(str,tea.name)==0) 
    { 
     display_tea(tea,i,i); 
     break; 
    } 
    else continue; 
  } 
  else if(str[0]=='3') 
  { 
   printf("please input the teacher's address:"); 
   gets(str);
   for(i=0;i<=numtea;i++) 
    if(strcmp(str,tea.addr)==0) 
    { 
     display_tea(tea,i,i); 
     break; 
    } 
    else continue; 
  } 
  if(i>numtea) 
  { 
   printf("Nothing has find\n"); 
   return -1; 
  } 
  return i; 
} 
} 

void delete_tea(Teacher tea[],int i) 
{ 
int j; 
while(i>=0) 
{ 
  for(j=i;j 
 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇申请内存的问题 下一篇 处理C语言之vfprintf的段错误

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: