C language course design: school bus management system (with source code)

The school bus management system
learns the relevant knowledge in C language and designs a school bus management system, which includes the following main functions (not limited to the following)

Realize the management of school bus information, including adding relevant information (plate number, number of seats, driver name, contact information, etc.), querying school bus information, deleting school bus information (school bus scrapping, etc.);
realizing the management of the bus station, including adding site information , Query site information, delete site information, etc .;
realize the storage of school bus information through files;
realize the allocation and management of different school buses corresponding to each campus (for example, Qingshan campus requires two school buses, Hongshan campus requires one school bus, and Huangjiahu campus requires three school buses );
Achieve the school bus reservation function, students and employees on campus can plan how many school buses are needed by the next day by input, to achieve a reasonable schedule of school buses, school bus drivers appropriate wheel breaks; (prompt, you can add a car for each car or driver Status sign)
Topic requirements:

Must be written in C language, and courses designed for C ++ or other advanced languages ​​are unqualified.
Using a simple console program, you can modify the background color, etc., and does not require graphical programming.
Only use the library functions that come with the compilation system, and do not allow the use of dynamic link libraries such as sqlite.dll.

 

I undertake the course design of java, C language, c ++, python, data structure, etc., privately talk about the source code and database, contact WeChat: 15813406574

Those who need all the code of this project will have a private chat on WeChat, always online

 

Next, let's show you the effect and important code display:

 

 

 

 

 

 

 

 

 

 

 

 

Part of the code display (if necessary, you can add WeChat: 15813406574):

1  int write_bus ()
 2  {
 3      FILE * fp;
 4      if ((fp = fopen ( " School bus information.txt " , " wb + " )) == NULL) // wb + Create a new binary file, the existing file will contain the content Clear, allow reading and writing 
5      {
 6          puts ( " Fail to open file! " );
 7          exit ( 0 );
 8      }
 9      
10      BusList p = b-> next;
 11      while (p)
 12      {
 13         fwrite (p, sizeof (BusNode), 1 , fp);
 14          p = p-> next;
 15      }
 16      fclose (fp); // Close the file, the data stream is saved to disk 
17      printf ( " School bus information is written ! \ N " );
 18      return  1 ;
 19  }
 20  
21  //////////// Read the school bus structure from the document //////////
 22  int read_bus ()
 23  {
 24      FILE * fp;
 25      if ((fp = fopen ( " School Bus Information.txt " ," rb + " )) == NULL) // rb + opens a binary file, the file must exist, allowing reading and writing 
26      {
 27          puts ( " Fail to open file! " );
 28          exit ( 0 );
 29      }
 30      BusList p = b;
 31      while (! feof (fp)) // debug finds that feof will read once more, so add fread return value to judge 
32      {
 33          BusNode tmp;
 34          if (fread (& tmp, sizeof (BusNode), 1 , fp) )
 35          {
 36             BusListInsert (& b, tmp.data); // Determine the return value of fscanf, it indicates the data successfully read 
37          }
 38      }
 39      fclose (fp);
 40      printf ( " Reading of school bus information is complete! \ N " );
 41      return  1 ;
 42  }
 43  
44  ///////////// Save the site structure data in the document 
45  int write_site ()
 46  {
 47      FILE * fp;
 48      if ((fp = fopen ( " site Information.txt " , " wb + " )) == NULL) //wb + Create a new binary file, the existing file will be emptied, allowing reading and writing 
49      {
 50          puts ( " Fail to open file! " );
 51          exit ( 0 );
 52      }
 53  
54      SiteList p = s-> next;
 55      while (p)
 56      {
 57          fwrite (p, sizeof (SiteNode), 1 , fp);
 58          p = p-> next;
 59      }
 60      fclose (fp); // Close the file, the data stream is stored in the disk 
61      printf ( "The site information has been written! \ N" );
 62      return  1 ;
 63  }
 64  
65  ///////////// Read the site structure from the document //////////
 66  int read_site ()
 67  {
 68      FILE * fp;
 69      if ((fp = fopen ( " Site Information.txt " , " rb + " )) == NULL)
 70      {
 71          puts ( " Fail to open file! " );
 72          exit ( 0 );
 73      }
 74     SiteList p = s;
 75      int i = 1 ;
 76      while (! Feof (fp)) // Debugging found that feof will read once more, so add fread return value to judge 
77      {
 78          SiteNode tmp;
 79          if (fread (& tmp, sizeof (SiteNode), 1 , fp))
 80          {
 81              SiteListInsert (& s, tmp.date, i); // Determine the return value of fscanf, which indicates the successfully read data 
82              i ++; SiteNum ++ ;
 83          }
 84      }
 85      fclose (fp);
 86      printf ( "The site information is read! \ n " ); printf ( " \ n " ); printf ( " \ n " );
 87      return  1 ;
 88 }

 

Guess you like

Origin www.cnblogs.com/crh666/p/12753186.html