91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2.34MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-12
  • 語言: C/C++
  • 標簽: 3種算法??

資源簡介

正規式轉換的3種算法,用C++實現的,還有NFA到DFA的轉換,還有DFA的最小化

資源截圖

代碼片段和文件信息

#pragma?warning(disable:4786)
#include?
#include?
#include?
#include
using?namespace?std;

#include?“REManage.h“

void?waitForInput()
{
cout< cout<<“輸入完畢后,請按任意鍵開始處理...“;
cout< getch();

HWND?note=FindWindow(“notepad“NULL);
::SendMessage(noteWM_CLOSE00);
}

void?ReadRE(string&?re)
{
ifstream?in(“RE.txt“);
in>>re;
}

void?ReadTestString(vector&?str)
{
ifstream?in(“TestString.txt“);
string?temp;
for(;getline(intemp)temp.size()>0;)
{
str.push_back(temp);
}
}

void?ReadNFA(vector&?edgeGathervector&?start?vector&?end)
{
ifstream?inNFA(“NFA.txt“);
EDGE?edge;
int?edgeNumstartNumendNumtemp;
edgeGather.clear();
start.clear();
end.clear();

inNFA>>edgeNum;

for(int?i=0;i {
inNFA>>edge.start>>edge.input>>edge.end;
edgeGather.push_back(edge);
}
inNFA>>startNum;
for(i=0;i {
inNFA>>temp;
start.push_back(temp);
}
inNFA>>endNum;
for(i=0;i {
inNFA>>temp;
end.push_back(temp);
}
}

void?ReadDFA(vector&?edgeGatherint?start?vector&?end)
{
ifstream?inDFA(“DFA.txt“);
EDGE?edge;
int?edgeNumstartNumendNumtemp;
edgeGather.clear();
end.clear();

inDFA>>edgeNum;

for(int?i=0;i {
inDFA>>edge.start>>edge.input>>edge.end;
edgeGather.push_back(edge);
}

inDFA>>startNum;
inDFA>>start;

inDFA>>endNum;
for(i=0;i {
inDFA>>temp;
end.push_back(temp);
}
}

void?OutTestResult(vector?strvector?isPass)
{
ofstream?out(“TestResult.txt“);
for(int?i=0;i {
out< if(isPass[i])
out<<“PASS“< else
out<<“FAILE“< }
}

void?main()
{
REManage?test;
ShellExecute(NULL“open““USE.txt“NULLNULLSW_SHOWNORMAL);
cout<<“說明:詳見USE.txt“< cout<<“請閱讀后按任意鍵開始...“;
getch();
HWND?note=FindWindow(“notepad“NULL);
::SendMessage(noteWM_CLOSE00);

cout<
string?re; //regular?expression
vector?stringGather; //test?string?gather
vector?edgeGather; //edge?gather?for?both?NFA?and?DFA
int?startDFA=0; //start?state?for?DFA
vector ?startNFA; //start?state?gather?for?NFA
vector ?end; //end?state?gather?for?both?NFA?and?DFA
vector?isPass;
for(;;)
{
stringGather.clear();
edgeGather.clear();
startNFA.clear();
end.clear();
isPass.clear();

int?choice=0;
cout<<“選擇你的輸入:“< cout<<“????1.?輸入正規式“< cout<<“????2.?輸入NFA“< cout<<“????3.?輸入DFA“< cout<<“????4.?退出“<
cout<<“輸入你的選擇(1~4):“;
cin>>choice;
switch(choice)
{
case?1:
ShellExecute(NULL“open““RE.txt“NULLNULLSW_SHOWNORMAL);
waitForInput();

ReadRE(re);
test.setRE(re);
test.Process();

break;
case?2:
ShellExecute(NULL“open““NFA.txt“NULLNULLSW_SHO

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????436214??2010-04-26?14:23??3種算法\正規式處理及自動機的轉換\Debug\main.obj

?????文件?????568817??2010-04-26?15:15??3種算法\正規式處理及自動機的轉換\Debug\REManage.obj

?????文件?????696467??2010-04-26?15:19??3種算法\正規式處理及自動機的轉換\Debug\REtoNFA.exe

?????文件????1078384??2010-04-26?15:19??3種算法\正規式處理及自動機的轉換\Debug\REtoNFA.ilk

?????文件????7028316??2010-04-26?14:23??3種算法\正規式處理及自動機的轉換\Debug\REtoNFA.pch

?????文件????1696768??2010-04-26?15:19??3種算法\正規式處理及自動機的轉換\Debug\REtoNFA.pdb

?????文件?????214016??2010-05-02?16:17??3種算法\正規式處理及自動機的轉換\Debug\vc60.idb

?????文件?????208896??2010-04-26?15:15??3種算法\正規式處理及自動機的轉換\Debug\vc60.pdb

?????文件????????146??2006-04-03?17:55??3種算法\正規式處理及自動機的轉換\DFA.txt

?????文件???????4327??2006-04-03?17:49??3種算法\正規式處理及自動機的轉換\main.cpp

?????文件?????????55??2006-03-31?22:24??3種算法\正規式處理及自動機的轉換\NFA.txt

?????文件?????????11??2010-04-26?14:50??3種算法\正規式處理及自動機的轉換\RE.txt

?????文件??????25273??2010-05-02?16:18??3種算法\正規式處理及自動機的轉換\REManage.cpp

?????文件???????4221??2010-05-02?16:18??3種算法\正規式處理及自動機的轉換\REManage.h

?????文件??????????0??2010-05-02?16:17??3種算法\正規式處理及自動機的轉換\Result.txt

?????文件???????4415??2006-03-30?12:48??3種算法\正規式處理及自動機的轉換\REtoNFA.dsp

?????文件????????537??2006-03-11?22:17??3種算法\正規式處理及自動機的轉換\REtoNFA.dsw

?????文件??????55808??2010-04-26?15:40??3種算法\正規式處理及自動機的轉換\REtoNFA.opt

?????文件????????248??2010-05-02?16:17??3種算法\正規式處理及自動機的轉換\REtoNFA.plg

?????文件?????????59??2010-04-26?14:45??3種算法\正規式處理及自動機的轉換\TestResult.txt

?????文件?????????31??2006-04-03?12:56??3種算法\正規式處理及自動機的轉換\TestString.txt

?????文件????????989??2006-04-03?17:54??3種算法\正規式處理及自動機的轉換\USE.txt

?????目錄??????????0??2010-05-02?16:09??3種算法\正規式處理及自動機的轉換\Debug

?????目錄??????????0??2010-05-02?16:18??3種算法\正規式處理及自動機的轉換

?????目錄??????????0??2010-05-02?16:08??3種算法

-----------?---------??----------?-----??----

?????????????12024216????????????????????26


評論

共有 條評論

相關資源