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

动物识别专家系统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 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件
  • ¥15 visual studio2022中文乱码无法解决
  • ¥15 关于华为5g模块mh5000-31接线问题
  • ¥15 keil L6007U报错
  • ¥15 webapi 发布到iis后无法访问
  • ¥15 初学者如何快速上手学习stm32?
  • ¥15 如何自动更换布娃娃图片上的衣服
  • ¥15 心理学eprime编程
  • ¥15 arduino esp8266开发