Yester07 2022-07-07 18:50 采纳率: 48.5%
浏览 578
已结题

动物识别专家系统C语言

动物识别专家系统
猪脑过载了已经,救命!
要求:
设计一个动物识别专家系统,规则库至少包含15条规则,可以识别至少7种动物,规则可增加;

界面显示要求:

1)有若干选择动物特征的选择列表;

2)表现判断动物时,使用了哪些规则;

3)表现数据库的变化;

4)显示规则的调用次序;

5)显示最后的结果,包含动物能识别出来和动物不能识别出来两种情况;

6)用C语言写

7)注释清楚

8)事实和规则从文本文件里面读取:
事实:

img

img

规则:

img

这里附上文本内容:
ProduceMilk
HaveFeathers
Fly
LayEggs
EatMeat
HaveSharpTeeth
HaveClaws
HaveForwardEyes
HaveHoofs
ChewAndRuminate
HaveFur
HaveTownyFur
HaveBlackpot
HaveBlackStripe
HaveLongNeck
HaveLongLegs
BlackAndWhite
CanSwim
GoodAtFlying
Mammal
Bird
Carnivore
Ungulate
AnimalsWithEvenToes
AfricanCheetah
Tiger
Giraffe
Zebra
Ostrich
penguin
Albatross

if HaveFeathers then Mammals
if ProduceMilk then Mammals
if HaveFur then Birds
if Fly and LayEggs then Birds
if EatMeat then Carnivore
if HaveShapeTeeth and HaveClaws and HaveForwardEyes then Carnivore
if Mammal and HaveHoofs then Ungulate
if Mammal and ChewAndRuminate then Mammal and AnimalsWithEvenToes
if Mammal and Carnivore and HaveTownyFur and HaveBlackpot then AfricanCheetah
if Mammal and Carnivore and HaveTownyFur and HaveBlackStripe then Tiger

目前自己写了个开头,感觉已经猪脑过载了:

#define _CRT_SECURE_NO_WARNINGS
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#define MAXSIZE 50
typedef struct RULE
{
    int ifs;
    int result;
}rule;
rule rules[MAXSIZE];
int rulesLength = 0;
char facts[MAXSIZE][20];
int factsLength = 0;

void factsAdd()
{
    char newrule[20];
    printf("please input a fact name:");
    scanf("%s", newrule);
    strcpy(facts[factsLength], newrule);
    factsLength++;
}

void FillText(FILE* fp, char text[])
{
    char ch;
    int length = 0;
    ch = fgetc(fp);
    while (ch != EOF)
    {
        text[length] = ch;
        ch = fgetc(fp);
        length++;
    }
    text[length] = '\0';
}

void factsBuild(char str[])
{
    int p = 0, j;
    while (str[p] != '\0')
    {
        j = 0;
        while (str[p] != '\n')
        {
            facts[factsLength][j] = str[p];
            p++;
            j++;
        }
        facts[factsLength][j] = '\0';
        factsLength++;
        printf("%d\t", factsLength);
        p++;
    }
}

int main()
{
    char str[1000];
    FILE* fp;
    fp = fopen("facts.txt", "r");
    FillText(fp, str);
    factsBuild(str);
    return 0;
}

  • 写回答

2条回答 默认 最新

  • 孙叫兽 前端领域优质创作者 2022-07-07 19:08
    关注

    这个用c语言不好实现吧,用点高级语言和插件配合一下,比如前端用vue,后端用java ,嵌套一个生物识别模块,设置一个阀值,参考人脸识别的功能比较好实现

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 7月8日
  • 创建了问题 7月7日

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘