#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
    char id[20];
    char name_venue[20];
    char sport_type[20];
    char description[100];
    int age_limit_min;
    int age_limit_max;
    float rent;
    char TIME[20];//年月日
    int time[16];//时段
    int order_cnt;//预定量
    char area[20];//场馆位置
    char name_stadium[20];//场馆名
} Venue;// 创建场地结构体，同时此场馆位于海淀区

void writeToFile(Venue venues[],int numVenues) 
{
    
    FILE* fp;
    fp = fopen("C:\\Users\\wu'ping\\Desktop\\death\\venues1.txt", "w"); // 打开txt文件进行写入
    if (fp == NULL) 
    {
        printf("无法打开文件！\n");
        return;
    }

    for (int i = 0; i < numVenues; i++) 
    {
        fprintf(fp, "%s\n", venues[i].area);//所在地区：
        fprintf(fp, "%s\n", venues[i].name_stadium);//场馆名: 
        fprintf(fp, "%s\n", venues[i].id);//ID: 
        fprintf(fp, "%s\n", venues[i].name_venue);//场地名: 
        fprintf(fp, "%s\n", venues[i].sport_type);//运动类型: 
        fprintf(fp, "%s\n", venues[i].description);//简述: 
        fprintf(fp, "%d ~ %d\n", venues[i].age_limit_min,venues[i].age_limit_max);//年龄限制:
        fprintf(fp, "%.2f\n", venues[i].rent);//租金: 
        fprintf(fp, "\n ");//对应时间是否被租借:
        for (int j = 0; j < 16; j++) 
        {
            if(venues[i].time[j] == 1)
            {
                fprintf(fp,"%d %d\n ",venues[i].TIME[j],venues[i].time[j]);//存疑
            }

        }
        fprintf(fp, "\n\n");
    }

    fclose(fp);
}

int main() 
{
    Venue venues[5];
    memset(venues,0,5*sizeof(Venue));
    // 填充场地信息
    strcpy(venues[0].area, "海淀区");
    strcpy(venues[0].name_stadium, "stadium1");
    strcpy(venues[0].id, "abc001");
    strcpy(venues[0].name_venue, "场地1");
    strcpy(venues[0].sport_type, "羽毛球");
    strcpy(venues[0].description, "紧张刺激，老少皆宜");
    venues[0].age_limit_min = 6;
    venues[0].age_limit_max = 65;
    venues[0].rent = 50.00;


    strcpy(venues[1].area, "海淀区");
    strcpy(venues[1].name_stadium, "stadium1");
    strcpy(venues[1].id, "abc002");
    strcpy(venues[1].name_venue, "场地2");
    strcpy(venues[1].sport_type, "羽毛球");
    strcpy(venues[1].description, "紧张刺激，老少皆宜");
    venues[1].age_limit_min = 6;
    venues[1].age_limit_max = 65;
    venues[1].rent = 70.00;

    
    strcpy(venues[2].area, "海淀区");
    strcpy(venues[2].name_stadium, "stadium1");
    strcpy(venues[2].id, "abc003");
    strcpy(venues[2].name_venue, "场地3");
    strcpy(venues[2].sport_type, "乒乓球");
    strcpy(venues[2].description, "紧张刺激，老少皆宜");
    venues[2].age_limit_min = 4;
    venues[2].age_limit_max = 70;
    venues[2].rent = 20.00;
    

    strcpy(venues[3].area, "海淀区");
    strcpy(venues[3].name_stadium, "stadium1");
    strcpy(venues[3].id, "abc004");
    strcpy(venues[3].name_venue, "场地4");
    strcpy(venues[3].sport_type, "乒乓球");
    strcpy(venues[3].description, "紧张刺激，老少皆宜");
    venues[3].age_limit_min = 4;
    venues[3].age_limit_max = 70;
    venues[3].rent = 20.00;


    strcpy(venues[4].area, "海淀区");
    strcpy(venues[4].name_stadium, "stadium1");
    strcpy(venues[4].id, "abc005");
    strcpy(venues[4].name_venue, "场地5");
    strcpy(venues[4].sport_type, "乒乓球");
    strcpy(venues[4].description, "紧张刺激，老少皆宜");
    venues[4].age_limit_min = 4;
    venues[4].age_limit_max = 70;
    venues[4].rent = 35.00;

    writeToFile(venues, 5);

    printf("信息已保存。\n");

    return 0;
}

根据上述代码完成以下功能:
根据场地名称进行查询；
根据场馆名称进行查询；
根据场地类别和所属区域进行查询；
根据是否有空余场地过滤查询结果；
根据租金排序所有场地；
根据预定量排序所有场地；