毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 报告 >> 正文

动物识别专家系统上机报告含源代码 第2页

更新时间:2007-9-26:  来源:毕业论文

int rule::Query()

       {

              int i;

              char c;

              int Tag=0;

              list *L;

              fact *F;

              F=Fact;

              L=Pre;

              if(L==NULL)

                     cout<<"\nError";

              while(L!=NUll)

              {

                     F=Fact;

                     for(;;)

                     {

                            if(abs(L->GetNumber())==F->GetNumber())

                                   break;

                            F=F->Next;   //查找与规则前提链中前提号相同的事实

                     }

                     if(L->GetNumber()>0)

                            {

                                   if((F->GetSucc())==true) {L=L->Next;continue;}

                                   if((F->GetSucc())==false) return false;

                            }   //如果事实的断言为真则判断下一个前提,为假,则表示该规则不适合

                     else

                            {

                                   if((F->GetSucc())==true) return false;

                                   if((F->GetSucc())==false) {L=L->Next;continue;}

                            }

                     cout<<endl<<F->GetName()<<"(Y/N)";

                     c=getchar();    //事实断言为不知道的时候,向用户询问

                     flushall();

                     if((c=='Y')||(c=='y'))

                            {

                                   if(L->GetNumber()>0)

                                          F->PutAct(1,true);  //设置事实的断言和激活标志

                                   if(L->GetNumber()<0)

                                          {

                                                 F->PutAct(1,true);

                                                 Tag=-1;

                                                 return false;

                                          }

                            }

                     else

                            {

                                   if(L->GetNumber()<0)

                                          F->PutAct(-1,false);

                                   else

                                          {

                                                 F->PutAct(-1,false);

                                                 Tag=-1;

                                                 return false;

                                          }

                            }

                            L=L->Next;

              }

              F=Fact;

              for(;;)

              {

                     if(Conc==F->GetNumber()) break;   //查找结论断言对应的事实

                     F=F->Next;

              }

              if(Conc<24)

                     {

                            F->PutAct(1,true);

                            return false;

                     }

              if(Tag!=-1)

                     {

                            F=Fact;

                            for(;;)

                            {

                                   if(Conc==F->GetNumber()) break;

                                   F=F->Next;

                            }

                            if(Conc<24)

                                   {

                                          F->PutAct(1,true);

                                          return false;

                                   }

                            cout<<"\nThis animal is"<<F->GetName();

                            return true;

                     }

              return false;

       };

上一页  [1] [2] [3] 下一页

动物识别专家系统上机报告含源代码 第2页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。