⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enterlis.c

📁 设计一个学生成绩管理系统
💻 C
字号:
#include"jinhe.h"
void enter_list()
{
  FILE *fp;
  extern char filename[15];
  int x,i,flag=0;
  float temp;
  struct student stu[M];
  if((fp=fopen(filename,"rb"))==NULL)
  { clrscr();
    gotoxy(15,15);
    printf("Cannot open file.Please press any key return.");
    getch();
    return;
  }
  fread(&stu[0],LEN,1,fp);
  for(i=0;stu[i].no;) fread(&stu[++i],LEN,1,fp);
  fclose(fp);
  for(;;)
  { if(flag==1) break;
    clrscr();
    x=0;
    gotoxy(5,2);
    printf("****************Computer technology and science 2 ban****************");
    gotoxy(52,3);
    printf("--Number enter 0 end--");
    gotoxy(5,4);
    printf("|-------------------------------------------------------------------|");
    gotoxy(5,5);
    printf("|--NUMBER--|-----NAME------|-SEX-|-ENGLI-|-COMPE-|-MATH-|-CPR-|-AVE-|");
    gotoxy(5,6);
    printf("|----------|---------------|-----|-------|-------|------|-----|-----|");
    for(;;i++)
    { gotoxy(5,7+x);printf("|");
      gotoxy(16,7+x);printf("|");
      gotoxy(32,7+x);printf("|");
      gotoxy(38,7+x);printf("|");
      gotoxy(46,7+x);printf("|");
      gotoxy(54,7+x);printf("|");
      gotoxy(61,7+x);printf("|");
      gotoxy(67,7+x);printf("|");
      gotoxy(73,7+x);printf("|");
      gotoxy(6,7+x);scanf("%ld",&stu[i].no);
      if(stu[i].no==0)
      { flag=1;
	break;
      }
      gotoxy(17,7+x);scanf("%s",&stu[i].name);
      gotoxy(33,7+x);scanf("%s",&stu[i].sex);
      gotoxy(39,7+x);scanf("%f",&temp); stu[i].english=temp;
      gotoxy(47,7+x);scanf("%f",&temp); stu[i].computer=temp;
      gotoxy(55,7+x);scanf("%f",&temp); stu[i].maths=temp;
      gotoxy(62,7+x);scanf("%f",&temp); stu[i].c_programe=temp;
      stu[i].average=(stu[i].english+stu[i].computer+stu[i].c_programe+stu[i].maths)/4;
      gotoxy(68,7+x);printf("%.1lf",stu[i].average);
      gotoxy(5,8+x);printf("|----------|---------------|-----|-------|-------|------|-----|-----|");
      x+=2;
      if((i+1)%9==0) { i++; clrscr();break;}
    }
  }
  if((fp=fopen(filename,"wb"))==NULL)
  { clrscr();
    gotoxy(15,15);
    printf("Cannot open file. Press any key return.");
    getch();
    return;
  }
  for(i=0;;i++)
   { if(fwrite(&stu[i],LEN,1,fp)!=1)
     { clrscr();
       gotoxy(15,15);
       printf("file write error.Press any key return.");
       getch();
       return;
     }
     if(stu[i].no==0) break;
   }
   fclose(fp);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -