admin管理员组

文章数量:1558092

【数据结构】要求以租房管理业务为背景,设计并实现一个“租房信息管理系统”软件,使用该系统可以方便查询每一个房屋信息,租客信息,租房登记信息等。

要求:
(1)房屋信息包括:地址、房产证号、户型、面积、装修等级、月租金等。
(2)租客信息包括:身份证号、姓名、工作单位、工龄、联系方式、租房补贴等。
(3)租房登记信息包括:租客、房屋、入住时间、租房合同号、备注等。
(4)完成以下的操作:房屋信息和租客信息的添加、修改、浏览、删除和查询及租房、退房;租房信息浏览与查询。
来源:期末课设!

  1. main函数
#include<stdio.h>
#include<string.h>

#include "house.h"
#include "rental.h"
#include "tenant.h"
//相应的头文件

int n;
int k;
int l;
int u = 0;
//定义四个全局变量,分别是n, k, l, u。

int main()
{
   
	int certain = 1;
	int num;
	if(u <= 1)
    {
   
        printf("             ************************************\n");
		printf("             *         租房信息管理系统         *\n");
		printf("             ************************************\n");
		printf("\n");
		printf("欢迎来到“租房信息管理系统”请选择您所需要的服务:\n");
		printf("输入每项服务所对应的数字即可!\n");
		u++;
    }//使用全局变量u迫使以上信息只显示一次。
    
	while(certain)
	{
   
	    printf("\n");
	    printf("您现在所进入的是一级菜单!\n");
		printf("1.房屋信息\n");
		printf("2.租客信息\n");
		printf("3.租房登记\n");
		printf("4.退出系统\n");
		printf("\n");

		scanf("%d", &num);
		switch(num)
		{
   
		case 1: house_information();
			break;
		case 2: tenant_information();
			break;
		case 3: rental_registration_information();
			break;
		case 4:
			{
   
			    printf("\n");
			    printf("您选择的是4<退出系统>\n");
				printf("非常感谢您的使用,欢迎下次使用!");
				certain = 0;
				return 0;
			}
			break;
		}
	}
	return 0;
}
  1. house.h文件
#ifndef HOUSE_H_INCLUDED
#define HOUSE_H_INCLUDED

void house_information();//房屋信息
void add_house_information();//添加房屋信息
void change_house_information();//修改房屋信息
void delete_house_information();//删除房屋信息
void show_house_information();//显示房屋信息
void find_house_information();//查找房屋信息
void rental_registration_information();//租房登记信息

struct ren_out{
   
	int no_housing; //房产证号
	char address[100]; //地址
	int area; //面积
	float month_price; //月租金
	char type_house[10]; //房屋户型
	char grade_decoration[10]; //房屋装修等级
	char if_outhouse[10]; //是否出租房屋
}a[10];//房屋信息

#endif // HOUSE_H_INCLUDED
  1. house.c文件
#include <stdio.h>
#include <string.h>

#include "house.h"

extern int n; //全局变量n

void house_information()//房屋信息菜单
{
   
	int certain = 1;
	int f;

	while(certain)
	{
   
	    printf("\n");
        printf("您现在进入的是二级菜单<房屋信息>\n");

        printf("1.添加房屋信息        2.修改房屋信息\n");
        printf("3.删除房屋信息        4.显示房屋信息\n");
        printf("5.查找房屋信息        6.返回上一界面\n");
        printf("7.已找到合适的租客,想要与他签合同!\n");
        printf("\n");

        scanf("%d", &f);
        switch(f)
            {
   
            case 1: add_house_information();
                break;
            case 2: change_house_information();
                break;
            case 3: delete_house_information();
                break;
            case 4: show_house_information();
                break;
            case 5: find_house_information();
                break;
            case 6:
                {
   
                    certain = 0;
                }
                break;
            case 7: rental_registration_information();
                break;
            }
	}
}

void add_house_information()//添加房屋信息
{
   
	int i;
	int certain = 1;
	char c;

    printf("\n");
	printf("您现在进入的是三级菜单<添加房屋信息>\n");
	printf("现在我们开始录入数据\n");
	printf("\n");

	while(certain)
	{
   
		for(i = n; i < 10; i++)
		{
   
			printf("请输入您想录入的房产证号:");
			scanf("%d", &a[i].no_housing);
			printf("请输入房屋地址:");
			scanf("%s", a[i].address);
			printf("请输入房屋的面积:");
			scanf("%d", &a[i].area);
			printf

本文标签: 管理系统信息租房信息房屋信息背景