这是本来要用PHP写的项目

但是是我学校C语言实训课的毕设

所以全项目是用C语言写的

同时,班上分的小组完成,而我所在的组里都是几个摸鱼的人,所以全项目是我一个人手搓的,虽然没有用上数据链表,用的是结构体加文件形成的类似于数据链表的形式实现其基本功能,但是足够了

言归正传

全项目分为三个文件

Structure.c文件是整个系统的基础所在,内含一个main函数,是整个系统的框架结构体现

#include"manage.h"int main()
{//文件File();//系统int input1 = 1, input2 = 0, pass = 0;do{if (pass == 0)pass = PassMenu();else if (pass == 1){AdMainMenu();scanf("%d", &input1);switch (input1){case 1:SystemInformation();break;case 2:do{AdUserManageMenu();scanf("%d", &input2);switch (input2){case 1:AdChangeUserInformation();break;case 2:AddUserInformation();break;case 3:DeleteUserInformation();break;case 4:SearchUserInformation();break;case 5:LookThroughAllUserInformation();break;case 6:printf("\n正在返回上一级...\n");input2 = 0;break;default:printf("\n输入错误,请重试\n");}} while (input2);break;case 3:do{AdBillingManageMenu();scanf("%d", &input2);switch (input2){case 1:AllUserBillingInformation();break;case 2:SearchUserBillingInformation();break;case 3:BillingStandard();break;case 4:UserBillingUp();break;case 5:UserBillingWarning();break;case 6:printf("\n正在返回上一级...\n");input2 = 0;break;default:printf("\n输入错误,请重试\n");}} while (input2);break;case 4:ExitMenu();input1 = 0;break;default:printf("\n输入错误,请重试\n");}}else if (pass == 2){UserMainMenu();scanf("%d", &input1);switch (input1){case 1:do{UserManageMenu();scanf("%d", &input2);switch (input2){case 1:ChangeUserInformation();break;case 2:LookThroughUserInformation();break;case 3:printf("\n正在返回上一级...\n");input2 = 0;break;default:printf("\n输入错误,请重试\n");}} while (input2);break;case 2:do{BillingManageMenu();scanf("%d", &input2);switch (input2){case 1:BillingStandard();break;case 2:BillingInformation();break;case 3:BillingUp();break;case 4:printf("\n正在返回上一级...\n");input2 = 0;break;default:printf("\n输入错误,请重试\n");}} while (input2);break;case 3:ExitMenu();input1 = 0;break;default:printf("\n输入错误,请重试\n");}}} while (input1);return 0;
}

Manage.h文件是整个系统的头文件,内含多个系统头文件,定义了多个函数

#include<stdio.h>
#include<string.h>
#include<stdlib.h>//文件
void File();
void AddUserInformation();
void DeleteUserInformation();
void SearchUserInformation();
void LookThroughAllUserInformation();
void LookThroughUserInformation();
void AdChangeUserInformation();
void ChangeUserInformation();//菜单
int PassMenu();
int AdMainMenu();
int UserMainMenu();
int ExitMenu();
int AdUserManageMenu();
int UserManageMenu();
int AdBillingManageMenu();
int BillingManageMenu();//系统
void SystemInformation();//登录
int CheckName();
int CheckPassword();//收费
void AllUserBillingInformation();
void SearchUserBillingInformation();
void UserBillingUp();
void UserBillingWarning();
void BillingInformation();
void BillingUp();
float BillingCalculation();
void BillingStandard();

System.c文件是整个系统的关键、核心,内含众多函数用于实现系统的各种功能

#include"manage.h"char Administer[] = "MingAn";
char AdPassword[] = "123lan??";
char Use[20] = { 0 };
char Password = { 0 };
struct User
{char name[21];char password[17];float water;float fee;
}user[1000] = { 0, 0, 0, 0 };//---------------------------------------文件--------------------------------------
void File()
{FILE* fp = fopen("UserList", "r");if (fp == NULL){printf("用户文件'UserList'不存在,将重新创建\n");fp = fopen("UserList", "w");}
}void AddUserInformation()
{FILE* fp = fopen("UserList", "a+");struct user;printf("\n请输入用户名(最长20位):");scanf("%s", user->name);printf("\n请输入密码(区分大小写、最长16位):");scanf("%s", user->password);printf("\n请输入已使用的水量(单位:吨)");scanf("%f", &user->water);printf("\n系统正在计算您的费用...\n");float take = user->water;user->fee = BillingCalculation(&take);fwrite(&(user), 1, sizeof(struct User), fp);fclose(fp);printf("\n用户添加成功!\n即将返回上一级...\n");
}void DeleteUserInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0;printf("\n请输入要删除的用户名:");scanf("%s", input);while (count <= num){if (strcmp(user[count].name, input) == 0){for (; count < num; count++){strcpy(user[count].name, user[count + 1].name);strcpy(user[count].password, user[count + 1].password);user[count].water = user[count + 1].water;user[count].fee = user[count + 1].fee;}printf("\n删除成功!\n即将返回上一级\n");break;}elsecount++;}if (count > num)printf("\n未找到此用户\n即将返回上一级\n");fp = fopen("UserList", "w");count = 0;while (count < num){fwrite(&user[count], 1, sizeof(struct User), fp);count++;}fclose(fp);
}void SearchUserInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0, take = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0;printf("\n请输入要查找的用户名:");scanf("%s", input);printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            用户信息                                              |\n");while (count <= num){if (strcmp(user[count].name, input) == 0){printf("|                                                                                                  |\n");printf("|       用户名:%-21s密码:%-17s用水量:%.1f吨\t费用:%.2f元\t   |\n", user[count].name, user[count].password, user[count].water, user[count].fee);count++;take = 1;}elsecount++;}if (take == 0)printf("\n未找到此用户!\n即将返回上一级...\n");else{printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回上一级");system("pause");}
}void LookThroughAllUserInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);int count = 0;printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            用户信息                                              |\n");while (count < num){if (strcmp(user[count].name, "") != 0){printf("|                                                                                                  |\n");printf("|       用户名:%-21s密码:%-17s用水量:%.1f吨\t费用:%.2f元\t   |\n", user[count].name, user[count].password, user[count].water, user[count].fee);count++;}elsecount++;}printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回上一级");system("pause");
}void LookThroughUserInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0, take = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0;printf("\n请输入用户名以验证身份:");scanf("%s", input);printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            用户信息                                              |\n");while (count <= num){if (strcmp(user[count].name, input) == 0){printf("|                                                                                                  |\n");printf("|       用户名:%-21s密码:%-17s用水量:%.1f吨\t费用:%.2f元\t   |\n", user[count].name, user[count].password, user[count].water, user[count].fee);count++;take = 1;}elsecount++;}if (take == 0)printf("\n用户验证失败!\n即将返回上一级...\n");else{printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回上一级");system("pause");}
}void AdChangeUserInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0, take = 1;printf("\n请输入用户名:");scanf("%s", input);while (count <= num){if (strcmp(user[count].name, input) == 0){while (take){printf("\n请输入要修改的密码:");scanf("%s", input);if (strcmp(user[count].password, input) == 0)printf("\n输入的密码与原密码一致,请重试!\n");else{strcpy(user[count].password, input);take = 0;}}printf("\n修改成功!\n即将返回上一级...\n");break;}count++;}if (count > num)printf("\n未找到此用户!\n即将返回上一级...\n");fp = fopen("UserList", "w");count = 0;while (count < num){fwrite(&user[count], 1, sizeof(struct User), fp);count++;}fclose(fp);
}void ChangeUserInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0, take = 1;printf("\n请输入你的用户名以确认身份:");scanf("%s", input);while (count <= num){if (strcmp(user[count].name, input) == 0){while (take){printf("\n请输入要修改的密码:");scanf("%s", input);if (strcmp(user[count].password, input) == 0)printf("\n输入的密码与原密码一致,请重试!\n");else{strcpy(user[count].password, input);take = 0;}}printf("\n修改成功!\n即将返回上一级...\n");break;}count++;}if (count > num)printf("\n验证用户身份失败!\n即将返回上一级...\n");fp = fopen("UserList", "w");count = 0;while (count < num){fwrite(&user[count], 1, sizeof(struct User), fp);count++;}fclose(fp);
}//---------------------------------------菜单--------------------------------------
int PassMenu()
{int pass = 0, a = 0;printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                             初始界面                                             |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                       未检测到用户登录信息                                       |\n");printf("|                                              请登录                                              |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");do{char username[20] = { 0 }, password[20] = { 0 };printf("\n请输入账号:");gets(username);printf("\n请输入密码(区分大小写):");gets(password);if (strcmp(username, Administer) == 0 && strcmp(password, AdPassword) == 0)//管理员{pass = 1;return pass;}else if (CheckName(username) == 1 && CheckPassword(password) == 1)//用户{pass = 2;return pass;}else{printf("\n用户名或密码错误,请重新输入\n");pass = 0;return pass;}} while (a);
}int AdMainMenu()
{printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            管理员界面                                            |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                         1.查看系统基本信息                                       |\n");printf("|                                         2.用户信息管理                                           |\n");printf("|                                         3.用户收费管理                                           |\n");printf("|                                         4.退出                                                   |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n请输入数字以进行下一步操作:");
}int UserMainMenu()
{printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            用户界面                                              |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                          1.用户信息管理                                          |\n");printf("|                                          2.用户收费管理                                          |\n");printf("|                                          3.退出                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n请输入数字以进行下一步操作:");
}int ExitMenu()
{printf("\n正在退出系统...\n");printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                          感谢您的使用                                            |\n");printf("|                                          欢迎下次光临                                            |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
}int AdUserManageMenu()
{printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            用户管理                                              |\n");printf("|                                                                                                  |\n");printf("|                                         1.修改用户信息                                           |\n");printf("|                                         2.增加用户信息                                           |\n");printf("|                                         3.删除用户信息                                           |\n");printf("|                                         4.查找用户信息                                           |\n");printf("|                                         5.查看用户信息                                           |\n");printf("|                                         6.返回                                                   |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n请输入数字以进行下一步操作:");
}int UserManageMenu()
{printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            用户管理                                              |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                         1.修改用户信息                                           |\n");printf("|                                         2.查看用户信息                                           |\n");printf("|                                         3.返回                                                   |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n请输入数字以进行下一步操作:");
}int AdBillingManageMenu()
{printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            收费管理                                              |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                     1.查看全体用户费用信息                                       |\n");printf("|                                     2.查看单一用户费用信息                                       |\n");printf("|                                     3.查看收费标准                                               |\n");printf("|                                     4.用户费用充值                                               |\n");printf("|                                     5.用户费用预警                                               |\n");printf("|                                     6.返回                                                       |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n请输入数字以进行下一步操作:");
}int BillingManageMenu()
{printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            收费管理                                              |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                     1.查看收费标准                                               |\n");printf("|                                     2.查看费用信息                                               |\n");printf("|                                     3.费用充值                                                   |\n");printf("|                                     4.返回                                                       |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n请输入数字以进行下一步操作:");
}//---------------------------------------信息--------------------------------------
void SystemInformation()
{printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            系统信息                                              |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                  系统名称:自来水收费管理系统                                    |\n");printf("|                             系统作者:十组 - 兰小贵、王奕力、杨浩楠                              |\n");printf("|                                         系统版本:V1.1                                           |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回主界面");system("pause");
}//---------------------------------------收费--------------------------------------
void AllUserBillingInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);int count = 0;printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            收费信息                                              |\n");while (count < num){if (strcmp(user[count].name, "") != 0){printf("|                                                                                                  |\n");printf("|              用户名:%-21s用水量:%.1f吨\t      费用:%.2f元\t           |\n", user[count].name, user[count].water, user[count].fee);count++;}elsecount++;}printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回上一级");system("pause");
}void SearchUserBillingInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0, take = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0;printf("\n请输入要查找的用户名:");scanf("%s", input);printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            收费信息                                              |\n");while (count <= num){if (strcmp(user[count].name, input) == 0){printf("|                                                                                                  |\n");printf("|              用户名:%-21s用水量:%.1f吨\t      费用:%.2f元\t           |\n", user[count].name, user[count].water, user[count].fee);count++;take = 1;}elsecount++;}if (take == 0)printf("\n未找到此用户!\n即将返回上一级...\n");else{printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回上一级");system("pause");}
}void UserBillingUp()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0, take = 1;printf("\n请输入用户名:");scanf("%s", input);while (count <= num){if (strcmp(user[count].name, input) == 0){printf("\n请输入充值金额:");float fee = 0;scanf("%f", &fee);user[count].fee += fee;printf("\n充值成功!\n即将返回上一级...\n");break;}count++;}if (count > num)printf("\n未找到此用户!\n即将返回上一级...\n");fp = fopen("UserList", "w");count = 0;while (count < num){fwrite(&user[count], 1, sizeof(struct User), fp);count++;}fclose(fp);
}void UserBillingWarning()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);int count = 0;printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            收费信息                                              |\n");while (count < num){if (strcmp(user[count].name, "") != 0){if (user[count].fee < 0){printf("|                                                                                                  |\n");printf("|              用户名:%-21s用水量:%.1f吨\t      费用:%.2f元\t           |\n", user[count].name, user[count].water, user[count].fee);count++;}elsecount++;}elsecount++;}printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回上一级");system("pause");
}void BillingInformation()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0, take = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0;printf("\n请输入用户名以验证身份:");scanf("%s", input);printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            用户信息                                              |\n");while (count <= num){if (strcmp(user[count].name, input) == 0){printf("|                                                                                                  |\n");printf("|       用户名:%-21s密码:%-17s用水量:%.1f吨\t费用:%.2f元\t   |\n", user[count].name, user[count].password, user[count].water, user[count].fee);count++;take = 1;}elsecount++;}if (take == 0)printf("\n用户验证失败!即将返回上一级...\n");else{printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回上一级");system("pause");}
}void BillingUp()
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);char input[21] = { 0 };int count = 0, take = 1;printf("\n请输入用户名以验证身份:");scanf("%s", input);while (count <= num){if (strcmp(user[count].name, input) == 0){printf("\n请输入充值金额:");float fee = 0;scanf("%f", &fee);user[count].fee += fee;printf("\n充值成功!\n即将返回上一级...\n");break;}count++;}if (count > num)printf("\n用户验证失败!\n即将返回上一级...\n");fp = fopen("UserList", "w");count = 0;while (count < num){fwrite(&user[count], 1, sizeof(struct User), fp);count++;}fclose(fp);
}float BillingCalculation(float *water)
{float fee = 0;if (*water <= 15)fee = *water * 0.6;else if (*water > 15 && *water <= 20)fee = 9 + (*water - 15) * 1.4;elsefee = 9 + 7 + (*water - 20) * 2.1;return -fee;
}void BillingStandard()
{printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                  欢迎使用本公司自来水收费管理系统                                |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("|                                            收费标准                                              |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                    用水15吨以内为0.6元/吨                                       |\n");printf("|                                    15-20吨为1.4元/吨                                            |\n");printf("|                                    20吨以上为2.1元/吨                                           |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("|                                                                                                  |\n");printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");printf("\n若要返回上一级");system("pause");
}//---------------------------------------登录--------------------------------------int CheckName(char Username[])
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0, take = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);int count = 0;while (count <= num){if (strcmp(user[count].name, Username) == 0){take = 1;return take;}elsecount++;}count--;if (count > num)take = 0;return take;
}int CheckPassword(char Password[])
{FILE* fp = fopen("UserList", "r");int r = 0, num = 0, take = 0;r = fread(&user[num], 1, sizeof(struct User), fp);while (r){num++;r = fread(&user[num], 1, sizeof(struct User), fp);}fclose(fp);int count = 0;while (count <= num){if (strcmp(user[count].password, Password) == 0){take = 1;return take;}elsecount++;}count--;if (count > num)take = 0;return take;
}

以上,做完这个项目后感觉整个人对文件和结构体的理解瞬间深刻了起来(感觉上的),听说下学期开始学Java了,C语言进阶也估计不会再学了

就这样吧,大致掌握一门编程语言的基础,写出这么一个勉强能用的系统,虽说才学了一学期的C语言(10月开学,12月中旬提前放假,9月开始看网课学习,大概三个月半的学习,大致上是掌握了)

(C语言)实现基于PHP的某公司自来水收费管理系统相关推荐

  1. 网上订票系统数据库c语言实现,基于c 的火车票订票管理系统的设计与实现.docx...

    基于c 的火车票订票管理系统的设计与实现 毕 业 设 计题目基于C#的火车票订票管理系统的设计与实现姓 名 周建华 学 号 201304150001 系(院)信息工程系 班 级P13软件技术1班指导教 ...

  2. java基于springboot的企业公司人事管理系统(java+springboot+vue+mysql)

    运行环境: 开发工具:IDEA /Eclipse 数据库:MYSQL5.7 应用服务:Tomcat7/Tomcat8 使用框架springboot+vue 项目介绍 人事是一个企业的命脉, 只有管理好 ...

  3. spring boot小型仪器公司生产管理系统 毕业设计源码031853

    Springboot小型仪器公司生产管理系统 摘要 本论文主要论述了如何使用java语言开发一个Springboot小型仪器公司生产管理系统,本系统将严格按照软件开发流程进行各个阶段的工作,采用B/S ...

  4. (附源码)ssm物流公司员工管理系统 毕业设计 261625

    基于ssm物流公司员工管理系统 摘  要 随着互联网大趋势的到来,社会的方方面面,各行各业都在考虑利用互联网作为媒介将自己的信息更及时有效地推广出去,而其中最好的方式就是建立网络管理系统,并对其进行信 ...

  5. 1、公司人事管理系统(C++)

    ** 基于C++的简易"公司人事管理系统" ** 励志:让所有猿同胞都能看懂的代码! (前方高能:注释贼多!) 第一次接触C++,是因为朋友的专业大作业,实在无法了找我帮忙写系统. ...

  6. 基于VUE+SSM框架的公司公文管理系统(毕业设计+论文)

    摘 要 随着IT技术的发展,人们的日常生活.工作已经离不开计算机.未来社会人们的生活和工作将越来越依赖于数字技术的发展,越来越数字化.网络化.虚拟化.计算机的发展历程以及目前的应用状况和发展趋势,可以 ...

  7. 基于Java毕业设计伊伊物流公司的管理系统源码+系统+mysql+lw文档+部署软件

    基于Java毕业设计伊伊物流公司的管理系统源码+系统+mysql+lw文档+部署软件 基于Java毕业设计伊伊物流公司的管理系统源码+系统+mysql+lw文档+部署软件 本源码技术栈: 项目架构:B ...

  8. 基于JAVA钢材商贸公司网络购销管理系统计算机毕业设计源码+系统+lw文档+部署

    基于JAVA钢材商贸公司网络购销管理系统计算机毕业设计源码+系统+lw文档+部署 基于JAVA钢材商贸公司网络购销管理系统计算机毕业设计源码+系统+lw文档+部署 本源码技术栈: 项目架构:B/S架构 ...

  9. 基于JAVA印染公司信息管理系统计算机毕业设计源码+系统+数据库+lw文档+部署

    基于JAVA印染公司信息管理系统计算机毕业设计源码+系统+数据库+lw文档+部署 基于JAVA印染公司信息管理系统计算机毕业设计源码+系统+数据库+lw文档+部署 本源码技术栈: 项目架构:B/S架构 ...

最新文章

  1. 远程挂载 NFS 共享目录引发死机问题
  2. R语言限制性立方样条(RCS, Restricted cubic spline)分析:基于logistic回归模型、南非心脏病数据集(South African Heart Disease)
  3. 从HTML5移动应用现状谈发展趋势
  4. 删除字符问题(贪心)
  5. OpenSSL X509 Certificate反序列化漏洞(CVE-2015-3825)成因分析
  6. Serverless:这真的是未来吗?(二)
  7. Redis系列(十四)、Redis6新特性之RESP3与客户端缓存(Client side caching)
  8. Oracle入门(五E)之讲解show parameter命令模糊查询
  9. react 示例_2020年的React Cheatsheet(+真实示例)
  10. NatureGenetics:所有五个异源四倍体棉花起源被厘清
  11. Centos7 安装配置 tomcat 并设置自动启动
  12. Python-模块和包.深入Celery之子任务及原语组式/链式/回调
  13. 天线下倾角示意图_天线下倾角地计算方法
  14. 计算机服务器安装系统安装教程,Windows Server操作系统安装教程
  15. ListView的优化
  16. PTA---计算天数
  17. 1503 Problem A 最简分式
  18. 【Python报错解决】from PIL import Image 提示调用_imaging失败,已解决
  19. 计算机网络基础:OSI模型与TCP/IP协议的关系
  20. 微信小程序 - 如何利用百度飞桨实现图像分类识别

热门文章

  1. python复数类型转换_Python程序设计——复数运算(包括极坐标转换)
  2. 唱吧android逆向加密算法笔记 此文章已做脱敏处理不会对原厂家app安全构成威胁,仅供学习
  3. 微信如何根据经纬度坐标查询具体地理位置
  4. 如何使用视频压缩软件,压缩视频大小 ?
  5. Grasshopper脚本电池处理全站仪数据,生成建筑、线状地物和地形
  6. 对Word文档中的指定内容进行替换
  7. 博朗x乐高全球限量型趣宝盒首发
  8. 100部伴随我们长大的电影
  9. SQL Server numeric数据类型
  10. Linux安装RabbitMQ详细教程