C++ 学校费用查询系统

2024年8月28日 | 阅读 29 分钟

该项目代码使用 C++ 编程语言编写。就系统而言,用户可以明确检查某个班级学生的费用清单,更改学校的费用安排,并以列表形式查看学校的费用安排。以下功能可作为菜单选项提供:

  • 费用清单: 此功能显示用户选择的班级中特定学生的费用清单。
  • 修改: 此功能更改班级的定价安排。用户可以更改不同领域的费用。
  • 列表: 此功能列出学校所有班级的总费用。
  • 帮助: 此功能列出每个菜单的功能。
  • 退出: 此命令终止正在运行的程序。

程序分解

我们将包含必要的文件以支持我们的 C++ 项目代码,而不会出现任何类型的错误。

Fstream: 用于创建新文件、向现有文件写入信息以及从现有文件读取数据的库。

dos.h: 此库包含用于处理中断、发出声音、处理日期和时间等的例程。它专用于 Borland,并与 Turbo C 编译器等编译器一起使用。

iomanip: 用于设置基字段标志。用于设置填充字符。它应用于小数精度设置。它用于设置字段宽度。

借助类 draw,该类具有数据成员如 LINE_HOR、LINE_VER 和 BOX,将创建或绘制学校费用查询系统的边框,其中包含费用清单、修改帮助和列表等所有内容。

费用类的结构将如上代码所示,包含浮点数 tuition、ac、science、computer 和 activity。为了修改系统的费用记录,一个名为 MODIFY_RECORD() 的函数将包含添加、修改、FEE_SLIP、LIST 和 HELP。

系统的主菜单将包含一些由用户选择的系统功能,并具有像 F 用于打开 fee.slip()、M 用于 fee.MODIFICATION()、L 用于 fee.LIST()、H 用于 fee.HELP() 和 Q 用于 exit() 的 switch case。如果用户按下了这些提及的键以外的键,系统将发出错误“非法选择,按任意键返回主菜单”。

函数 LINE_HOR 将负责为系统菜单创建一条水平线。

函数 LINE_VER 将负责为系统菜单创建一条水平线。

上述函数使用 LINE_HOR 和 LINE_VER 函数为系统菜单创建框结构。

如果用户在系统使用过程中想编辑学校的费用结构,那么上面的代码将有所帮助。它将打开系统的数据文件,使用 MODIFY_RECORD 函数进行永久更改。

如果系统用户想列出每个班级的费用结构,那么上面的代码将有所帮助。它将显示班级列表以及学费、空调、科学、计算机和活动费用结构。

上述代码的功能是显示费用结构,包括学费、科学、计算机和其他活动以及年度费用。

上述代码功能是打印用户输入的学生姓名的费用清单。系统将显示消息“输入学生姓名”,系统将在系统的数据文件中搜索该姓名并打印用户的费用清单。

如果用户不明白如何使用系统,可以按 H 寻求帮助,上述说明将显示在屏幕上。

C++ 学校费用查询系统程序

输出

/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
          -                                                           -
          -     Fee Structure System                  -
          -                                                           -
          -     Press Any Key To ........Continue -
Press the corresponding Keys for the desired action..
                              * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
                              |                                                                                |
                              |                             F: FEE SLIP                                 |
                              |                                                                                |
                              |                            M: MODIFY                                |
                              |                                                                                |
                              |                                L: LIST                                      |                                                                                                         
                              |                                                                                 |
                              |                                H: HELP                                    |
                              |                                                                                 |
                              |                               Q: QUIT                                     |


??????????????????????????????????????????????????????????????????????
?                                          TOTAL FEES FOR THE CLASSES                                                    ?
????????????????????????????????????????????????????????????????????????
?    CLASS             TOTAL FEES                                                                                                  ?
????????????????????????????????????????????????????????????????????????
?    1                       380                                                                                                                     ?
?    2                       380                                                                                                                     ?
?    3                     380                                                                                                                ?
?    4                     380                                                                                                                ?
?    5                     380                                                                                                                ?
?    6                     460                                                                                                                ?
?    7                     460                                                                                                                ?
?    8                     460                                                                                                                ?
?    9                      530                                                                                                                  ?
?    10                  540                                                                                                                ?
?    11                  670                                                                                                                ?
?    12                  670                                                                                                                ?
???????????????????????????????????????????????????????????????????????
?   Press any key to continue.............                                                                                      ?
???????????????????????????????????????????????????????????????????????
Enter Class to see the Fee Structure : 11

     Name : Suraj

                    ??????????????????????????????????????????
                    ?                 YOUR SCHOOL                                                                             ?
                    ?                 Date: 19/11/2022                                                                       ?
                    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
                    ?                 NAME  : Suraj                                                                              ?
                    ?                 CLASS : 11                                                                                    ?
                    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
                    ?    PARTICULARS          ?    AMOUNT                                                           ?
                    ? ? ? ? ? ? ? ? ? ? ? ?  ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?  ? ? ?   ? 
                    ?                                     ?                                                                                ?
                    ?  Tuition fees               ?   2.5e+002                                                             ?
                    ?  Annual charges fees ?  50                                                                          ?
                    ?  Science fees              ?  0                                                                            ?
                    ?  Computer fees          ?  40                                                                          ?
                    ?  Activity fees              ?  40                                                                          ?
                    ?    TOTAL                      ?  380.000000                                                         ?
                    ?        Press any key to return to the main menu........                           ?
                    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
                    ?                                 CASHIER                                                                        ?
                    ??????????????????????????????????????????
Enter Class for the Modification of the Fee Structure : 12
Class : 12

     ~~~~~~~~~~~~
     Tution Fee  : 4.5e+002
     Annual charges Fee  : 50
     Science Fee : 60
     Computer Fee: 60
     Activity Fee : 50
     Do you want to modify the fee structure (y/n) : y
Tuition Fee : 100
     Annual Charges Fee : 100
     Science Fee : 40
     Computer Fee :40
     Activity Fee :100
     Do you want to save (y/n) : y

     7Record Modified or Press  for no changehange

     Press any key to continue...........
H
This is a fee structure program
It can be used to :
1. View the fee slip of a student of a class
2. Modify the fee structure of the school
3. View the fee structure of the school in the form of a list
The menu functions are described as follows
1. FEE SLIP:  This function displays the fee slip for a given student
 from the class entered by the user.
2. MODIFY:    This function modifies the fee structure for a give class.
 The user can change the fees for various fields
3. LIST:      This function displays the list of total fees for all the
Press any key to continue...........

下一个主题C++ 中的向量对