教务管理系统实现方法

 2025-01-16 06:06:01  阅读 813  评论 0

摘要:#include<stdio.h>#include<stdlib.h>#include<conio.h>#include<dos.h>#include<string.h>#defineLENsizeof(structstudent)#defineFORMAT"%-8d%-15s%-12.1lf%-12.1lf%-12.1lf%-12.1lfn"#defineDATAstu[i].num,stu[i].name,stu[i].elec,stu[i].expe,stu[

#include<stdio.h>

#include<stdlib.h>

#include<conio.h>

教务管理系统实现方法

#include<dos.h>

#include<string.h>

#define LEN sizeof(struct student)

#define FORMAT "%-8d%-15s%-12.1lf%-12.1lf%-12.1lf%-12.1lfn"

#define DATA stu[i].num,stu[i].name,stu[i].elec,stu[i].expe,stu[i].requ,stu[i].sum

struct student

{ int num

  char name[15]

  double elec

  double expe

  double requ

  double sum

}

struct student stu[50]

void in()

void show()

void order()

void del()

void modify()

void menu()

void insert()

void total()

void search()

void main()

{ int n

  menu()

  scanf("%d",&n)

  while(n)

  { switch(n)

     { case 1: in()break

       case 2: search()break

       case 3: del()break

       case 4: modify()break

       case 5: insert()break

       case 6: order()break

       case 7: total()break

   case 8: show()break

       default:break

     }

    getch()

    menu()

    scanf("%d",&n)

  }

}

void in()

{ int i,m=0

  char ch[2]

  FILE *fp

  if((fp=fopen("data.txt","a+"))==NULL)

  { 

  printf("can not openn")

  return

  }

  while(!feof(fp))

  {

  if(fread(&stu[m] ,LEN,1,fp)==1)

  m++

  }

  fclose(fp)

  if(m==0)

  printf("No record!n")

  else

  {

  system("cls")

          show()

  }

  if((fp=fopen("data.txt","wb"))==NULL)

  {

  printf("can not openn")

  return

  }

  for(i=0i<mi++)

   fwrite(&stu[i] ,LEN,1,fp)

  printf("please input(y/n):")

  scanf("%s",ch)

while(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)

{

    printf("number:")

scanf("%d",&stu[m].num)

    for(i=0i<mi++)

    if(stu[i].num==stu[m].num)

    {

    printf("the number is existing,press any to continue!")

    getch()

    fclose(fp)

    return

    }

     printf("name:")

 scanf("%s",stu[m].name)

     printf("elective:")

     scanf("%lf",&stu[m].elec)

     printf("experiment:")

 scanf("%lf",&stu[m].expe)

     printf("required course:")

 scanf("%lf",&stu[m].requ)

     stu[m].sum=stu[m].elec+stu[m].expe+stu[m].requ

     if(fwrite(&stu[m],LEN,1,fp)!=1)

     {

 printf("can not save!")

 getch()

 }

     else

 {

 printf("%s saved!n",stu[m].name)

 m++

 }

     printf("continue?(y/n):")

     scanf("%s",ch)

  }

  fclose(fp)

  printf("OK!n")

}

void show()

 { FILE *fp

   int i,m=0

   fp=fopen("data.txt","rb")

   while(!feof(fp))

   {

   if(fread(&stu[m] ,LEN,1,fp)==1) 

   m++

   }  

   fclose(fp)

   printf("number  name           elective    experiment  required    sumtn")

   for(i=0i<mi++)

       { 

   printf(FORMAT,DATA)

       }

     }

 

void menu()

{

  system("cls")

  printf("nnnnn")

  printf("tt|---------------------STUDENT-------------------|n")

  printf("tt|t 0. exit                                |n")

  printf("tt|t 1. input record                        |n")

  printf("tt|t 2. search record                       |n")

  printf("tt|t 3. delete record                       |n")

  printf("tt|t 4. modify record                       |n")

  printf("tt|t 5. insert record                       |n")

  printf("tt|t 6. order                               |n")

  printf("tt|t 7. number                              |n")

  printf("tt|t 8. show                                |n")

  printf("tt|-----------------------------------------------|nn")

  printf("tttchoose(0-8):")

}

void order()

{ FILE *fp

  struct student t

  int i=0,j=0,m=0

  if((fp=fopen("data.txt","r+"))==NULL)

     { 

printf("can not open!n")

        return

  }

  while(!feof(fp)) 

  if(fread(&stu[m] ,LEN,1,fp)==1) 

  m++

  fclose(fp)

  if(m==0) 

  {

  printf("no record!n")

  return

  }

  if((fp=fopen("data.txt","wb"))==NULL)

     {

  printf("can not openn")

  return}

  for(i=0i<m-1i++)

      for(j=i+1j<mj++)

          if(stu[i].sum<stu[j].sum)

          { t=stu[i]stu[i]=stu[j]stu[j]=t}

  if((fp=fopen("data.txt","wb"))==NULL)

     { printf("can not openn")return}

  for(i=0i<mi++)

      if(fwrite(&stu[i] ,LEN,1,fp)!=1)

       { 

        printf("%s can not save!n") 

        getch()

      }

  fclose(fp)

  printf("save successfullyn")

}

void del()

{FILE *fp

  int snum,i,j,m=0

  char ch[2]

  if((fp=fopen("data.txt","r+"))==NULL)

     { printf("can not openn")return}

  while(!feof(fp))  if(fread(&stu[m],LEN,1,fp)==1) m++

  fclose(fp)

  if(m==0) 

  {

  printf("no record!n")

  return

  }

  printf("please input the number:")

  scanf("%d",&snum)

    for(i=0i<mi++)

     if(snum==stu[i].num)

     break

     printf("find the student,delete?(y/n)")

     scanf("%s",ch)

      if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)

      for(j=ij<mj++)

      stu[j]=stu[j+1]

      m--

      if((fp=fopen("data.txt","wb"))==NULL)

     { printf("can not openn")return}

  for(j=0j<mj++)

      if(fwrite(&stu[j] ,LEN,1,fp)!=1)

       { printf("can not save!n")

      getch()}

  fclose(fp)

  printf("delete successfully!n")

}

void search()

{ FILE *fp

  int snum,i,m=0

  char ch[2]

  if((fp=fopen("data.txt","rb"))==NULL)

     { printf("can not openn")return}

  while(!feof(fp))  if(fread(&stu[m],LEN,1,fp)==1) m++

  fclose(fp)

  if(m==0) {printf("no record!n")return}

  printf("please input the number:")

  scanf("%d",&snum)

  for(i=0i<mi++)

     if(snum==stu[i].num)

     { printf("find the student,show?(y/n)")

     scanf("%s",ch)

      if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0) 

        {

          printf("number  name           elective    experiment  required    sumtn")

          printf(FORMAT,DATA)

  break

     }

     }   

  if(i==m) printf("can not find the student!n")

}

void modify()

{ FILE *fp

  int i,j,m=0,snum

  if((fp=fopen("data.txt","r+"))==NULL)

     { printf("can not openn")return}

  while(!feof(fp))  

 if(fread(&stu[m],LEN,1,fp)==1) m++

  if(m==0) {printf("no record!n")

  fclose(fp)

  return

  }

  show()

  printf("please input the number of the student which do you want to modify!n")

  printf("modify number:")

  scanf("%d",&snum)

  for(i=0i<mi++)

  if(snum==stu[i].num)

  break

  printf("find the student!you can modify!n")

 

  printf("name:")

  scanf("%s",stu[i].name)

          printf("elective:")

  scanf("%lf",&stu[i].elec)

          printf("experiment:")

  scanf("%lf",&stu[i].expe)

          printf("required course:")

  scanf("%lf",&stu[i].requ)

  printf("modify successful!")

  stu[i].sum=stu[i].elec+stu[i].expe+stu[i].requ

  if((fp=fopen("data.txt","wb"))==NULL)

     { printf("can not openn")return}

  for(j=0j<mj++)

  if(fwrite(&stu[j] ,LEN,1,fp)!=1)

       { printf("can not save!") getch() }

  fclose(fp)

 }

void insert()

{ FILE *fp

  int i,j,k,m=0,snum

  if((fp=fopen("data.txt","r+"))==NULL)

     { printf("can not openn")return}

  while(!feof(fp))  

 if(fread(&stu[m],LEN,1,fp)==1) m++

  if(m==0) {printf("no record!n")

  fclose(fp)

  return

  }

  printf("please input position where do you want to insert!(input the number)n")

  scanf("%d",&snum)

  for(i=0i<mi++)

  if(snum==stu[i].num)

  break

  for(j=m-1j>ij--)

           stu[j+1]=stu[j]

  printf("now please input the new information.n")

          printf("number:")

  scanf("%d",&stu[i+1].num)

  for(k=0k<mk++)

    if(stu[k].num==stu[i+1].num)

    {

    printf("the number is existing,press any to continue!")

    getch()

    fclose(fp)

    return

    }

  printf("name:")

  scanf("%s",stu[i+1].name)

          printf("elective:")

  scanf("%lf",&stu[i+1].elec)

          printf("experiment:")

  scanf("%lf",&stu[i+1].expe)

          printf("required course:")

  scanf("%lf",&stu[i+1].requ)

  stu[i+1].sum=stu[i+1].elec+stu[i+1].expe+stu[i+1].requ

  if((fp=fopen("data.txt","wb"))==NULL)

     { printf("can not openn")return}

  for(k=0k<=mk++)

  if(fwrite(&stu[k] ,LEN,1,fp)!=1)

       { printf("can not save!") getch() }

  fclose(fp)

 }

void total()

{ FILE *fp

  int m=0

  if((fp=fopen("data.txt","r+"))==NULL)

     { printf("can not openn")return}

  while(!feof(fp))  

  if(fread(&stu[m],LEN,1,fp)==1) 

  m++

  if(m==0) {printf("no record!n")fclose(fp)return}

  printf("the class are %d students!n",m)

  fclose(fp)

 }

高校教务管理系统(vb+SQL)怎么做

#include <iostream>

//#include <String>

using namespace std

struct Date

{

int year

int month

int day

}

class Person

{

protected:

Date birthday

char* name

int personID

public:

Person(char* name,int personID,Date birthday)

{

this->birthday=birthday

this->name=name

this->personID=personID

}

void say()

{

cout<<name<<"说话"<<endl

}

virtual void ShangKe()=0

}class Teacher:public Person

{

private:

int teacherID

public:

Teacher(char * name,int personID,int teacherID, Date birthday):Person(name,personID,birthday)

{

this->teacherID=teacherID

}

void ShangKe()

{

cout<<name<<"老师上课"<<endl

}

}class Student:public Person

{

private:

int studentID

public:

Student(char * name,int personID,int teacherID,Date birthday):Person(name,personID,birthday)

{

this->studentID=studentID

}

void ShangKe()

{

cout<<name<<"学生听课"<<endl

}

}

void main()

{

Person *p

Date birthday

birthday.year=2000

birthday.month=1

birthday.day=1

Teacher tea("zhangsan",123,001,birthday)

Student stu("lisi",456,007,birthday)

p=&tea

p->ShangKe()

p=&stu

p->ShangKe()

}

大家来投我一票···嘿嘿··

你问的这也太有含糊了。

只能说业务大概包含:

教师信息

班级信息

课程信息

学生信息

成绩信息

综合查询

系统管理

以此类推,每个里面都有增删查改,都实现了就是个教务系统

以上就是关于C语言编写一个教务管理系统 注:可以把这个程序也发我一下吗全部的内容,如果了解更多相关内容,可以关注,你们的支持是我们更新的动力!

版权声明:我们致力于保护作者版权,注重分享,被刊用文章【教务管理系统实现方法】因无法核实真实出处,未能及时与作者取得联系,或有版权异议的,请联系管理员,我们会立即处理! 部分文章是来自自研大数据AI进行生成,内容摘自(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供学习参考,不准确地方联系删除处理!;

原文链接:https://www.yxiso.com/zhishi/1002054.html

发表评论:

关于我们
院校搜的目标不仅是为用户提供数据和信息,更是成为每一位学子梦想实现的桥梁。我们相信,通过准确的信息与专业的指导,每一位学子都能找到属于自己的教育之路,迈向成功的未来。助力每一个梦想,实现更美好的未来!
联系方式
电话:
地址:广东省中山市
Email:beimuxi@protonmail.com

Copyright © 2022 院校搜 Inc. 保留所有权利。 Powered by BEIMUCMS 3.0.3

页面耗时0.0351秒, 内存占用2.01 MB, 访问数据库23次

陕ICP备14005772号-15