亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? illation_machine.h

?? 一個基于H.wang的謂詞演算公式的機器證明的vc實現
?? H
字號:
class Illation_machine;
class Formulas;

class  Node{
	friend class Formulas;
	friend class Illation_machine;
public:
	Node();
	~Node(){ delete []formula;}
	Node(char *str,Node *link);
private:
	char *formula;
	Node *next;
};
Node::Node(char *str,Node *link){
	formula=new char[strlen(str)+1];
	mystrcpy(formula,str);
	next=link;
}

class Formulas{
	friend class Illation_machine;
public:
	Formulas(){ first=last=NULL;number=0; }
	Formulas(char *str);
	~Formulas();
	void Add(char *str);
	void Delete(Node *p);
	void copy(Formulas *f);
	bool Isin(char *str);
	void Toinfix(char *str);
	void print(CString &str);
	bool isoperator(char c){ return c=='!'||c=='*'||c=='+'||c=='>'||c=='=';}
private:
    Node *first,*last;
	int number;
};
Formulas::Formulas(char *str){
	first=last=new Node(str,NULL);
	number=1;
}
Formulas::~Formulas(){
	Node *p,*temp=first;
	while(temp!=NULL){
		p=temp;
		temp=temp->next;
		delete p;
	}
}
void Formulas::Add(char *str){
	if(first==NULL)
		first=last=new Node(str,NULL);
	else{
		last->next=new Node(str,NULL);
		last=last->next; 
	}
	number++;
}

void Formulas::Delete(Node *p){
		if(first!=NULL){
			if(p==first){
				first=first->next;
				delete p;
			}
			else{
				Node *temp=first,*pre;
				while(temp!=NULL&&temp!=p){
					pre=temp;
					temp=temp->next;
				}
				if(temp!=NULL){
					pre->next=temp->next;
					delete temp;
					if(temp==last)
						last=pre;
				}
			}
		}
		number--;
}

void Formulas::copy(Formulas *f){
	if(f->first!=NULL&&f->number!=0){
		last=first=new Node(f->first->formula,NULL);
		Node *temp=f->first->next;
		while(temp!=NULL){
			last->next=new Node(temp->formula,NULL);
			last=last->next;
			temp=temp->next;
		}
	}
	number=f->number;
}

bool Formulas::Isin(char *str){
	Node *temp=first;
	while(temp!=NULL){
		if(strcmp(str,temp->formula)==0)
			return true;
		temp=temp->next;
	}
	return false;
}

void Formulas::Toinfix(char *str){
	mystack<char *> st;
	for(int i=strlen(str)-1;i>=0;i--){
		if( ('a'<=str[i]&&str[i]<='z')||('A'<=str[i]&&str[i]<='Z') ){
			char *temp=new char[2];
			temp[0]=str[i];
			temp[1]='\0';
			st.push(temp);
		}
		else if(str[i]=='!'){
			int k=0;
			char *op=st.top(),*temp;
			st.pop();
			temp=new char[strlen(op)+4];
			temp[0]='!';
			if(strlen(op)!=1&&op[0]!='!')temp[++k]='(';
			mystrcpy(temp+k+1,op);
			if(strlen(op)!=1&&op[0]!='!')temp[strlen(op)+2]=')';
			temp[strlen(op)+2*k+1]='\0';
			st.push(temp);
			delete []op;
		}
		else if(isoperator(str[i])){
			int k1=0,k2=0;
			char *op1,*op2;
			op1=st.top(); st.pop();
			op2=st.top(); st.pop();
			char *temp=new char[strlen(op1)+strlen(op2)+6];
			if(strlen(op1)>2)temp[k1++]='(';
			mystrcpy(temp+k1,op1);
			if(strlen(op1)>2)temp[strlen(op1)+k1]=')';
			temp[strlen(op1)+k1*2]=str[i];

			if(strlen(op2)>2){temp[strlen(op1)+2*k1+1]='(';k2++;}
			mystrcpy(temp+strlen(op1)+2*k1+k2+1,op2);
			if(strlen(op2)>2)temp[strlen(op1)+strlen(op2)+2*k1+k2+1]=')';
			temp[strlen(op1)+strlen(op2)+2*k1+2*k2+1]='\0';
			st.push(temp);
			delete []op1;
			delete []op2;
		}
	}
	char *temp=st.top();st.pop();
	mystrcpy(str,temp);
	delete []temp;
}

void Formulas::print(CString &str){
	Node *temp=first;
	while(temp!=NULL){
		if(strlen(temp->formula)==1){
			str+=temp->formula;
			if(temp!=last)str+=",";
		}
		else{
			char *form=new char[strlen(temp->formula)*3];
			mystrcpy(form,temp->formula);
			Toinfix(form);
			str+=form;
			if(temp!=last)str+=",";
			delete form;
		}
		temp=temp->next;
	}
}
//第二部分,推理機類

class Illation_machine{
public:
	Illation_machine(){ formula=NULL; }
	Illation_machine(char *str);
	~Illation_machine(){ delete []formula; }
	int Illation(myqueue<CString> &poof_procedure);
private:
	int Illation(Formulas *pre,Formulas *post,int &line,myqueue<CString> &poof_procedure);
	bool Detect(Formulas *f,char &operat,char *op1,char *op2);
	bool isoperator(char c){ return c=='!'||c=='*'||c=='+'||c=='>'||c=='=';}
	int order(char c){				//字符的秩
		if(c=='!')
			return 0;
		else if(isoperator(c))
			return 1;
		else
			return -1;
	}
	char *formula;
};

Illation_machine::Illation_machine(char *str){//在此構造函數中將str轉為前綴存于formula中
	mystack<char> temp,operat;
	for(int i=strlen(str)-1;i>=0;i--){
		if( ('a'<=str[i]&&str[i]<='z')||('A'<=str[i]&&str[i]<='Z') )
			temp.push(str[i]);
		else{
			if(str[i]=='('){
				char c;
				while( ( c=operat.top() )!=')' ){ temp.push(c); operat.pop(); }
				operat.pop(); 
			}
			else if(str[i]=='!')
				temp.push(str[i]);
			else
				operat.push(str[i]);
		}
	}
	while(operat.IsEmpty ()==false){
		temp.push(operat.top());
		operat.pop();
	}
	formula=new char[strlen(str)+1];
	int j=0;
	while(temp.IsEmpty ()==false){
		formula[j++]=temp.top();
		temp.pop();
	}
	formula[j]='\0';
}


bool Illation_machine::Detect(Formulas *f,char &operat,char *op1,char *op2){

	if(f->number==0) return false;
	Node *temp=f->first;
	while(temp!=NULL){
		if(isoperator(temp->formula[0])){
			int n=strlen(temp->formula);
			operat=temp->formula[0];
			if(temp->formula[0]=='!'){
				mystrncpy(op1,(temp->formula)+1,n-1);
				op1[n-1]='\0';
			}
			else{
				int count=1,s=1,start=1;
				while(count<n){
					s+=order(temp->formula[count]);
					if(s==0){
						s=1;
						if(start==1){
							mystrncpy(op1,temp->formula+start,count-start+1);
							op1[count-start+1]='\0';
						}
						else{
							mystrncpy(op2,temp->formula+start,count-start+1);
							op2[count-start+1]='\0';
						}
					start=count+1;
					}
					count++;
				}
			}
			f->Delete(temp); 
			break;
		}
		temp=temp->next; 
	}
	if(temp!=NULL)
		return true;
	else
		return false;
}

int Illation_machine::Illation(myqueue<CString> &poof_procedure){
	Formulas *pre,*post;
	pre=new Formulas;
	post=new Formulas(formula);
	int line=1;
	int f=Illation(pre,post,line,poof_procedure);
	delete pre;
	delete post;
	return f;
}

int Illation_machine::Illation(Formulas *pre,Formulas *post,int &line,myqueue<CString> &poof_procedure){
	char operat;
	char op1[100],op2[100],reason[8];
	Formulas pre1,post1,pre2,post2;
	int reason1,reason2,f1=1,f2=1;
	pre1.copy(pre);
	post1.copy(post);
	if(Detect(pre,operat,op1,op2)){
		pre2.copy(pre);
		post2.copy(post);
		switch(operat){
			case '!':post->Add(op1);
				     f1=Illation(pre,post,line,poof_procedure);
					 mystrcpy(reason,"!├");
					 break;
			case '*':pre->Add(op1);
					 pre->Add(op2);
					 f1=Illation(pre,post,line,poof_procedure);
					 mystrcpy(reason,"*├");
					 break;
			case '+':pre->Add(op1);
					 f1=Illation(pre,post,line,poof_procedure);
					 reason1=line-1;
					 pre2.Add(op2);
					 f2=Illation(&pre2,&post2,line,poof_procedure);
					 reason2=line-1;
					 mystrcpy(reason,"+├");
					 break;
			case '>':post->Add(op1);
					 f1=Illation(pre,post,line,poof_procedure);
					 reason1=line-1;
					 pre2.Add(op2);
					 f2=Illation(&pre2,&post2,line,poof_procedure);
					 reason2=line-1;
					 mystrcpy(reason,">├");
					 break;
			case '=':;pre->Add(op1);
					pre->Add(op2);
					f1=Illation(pre,post,line,poof_procedure);
					reason1=line-1;
					post2.Add(op1);
					post2.Add(op2);
					f2=Illation(&pre2,&post2,line,poof_procedure);
					reason2=line-1;
					mystrcpy(reason,"=├");
					break;
		}
		CString temp;
		temp.Format(_T("(%d)    "),line++);
		pre1.print(temp);
		temp+="├";
		post1.print(temp);
		temp+="              是由(";
		if(operat=='!'||operat=='*'){
			CString t;
			t.Format(_T("%d"),line-2);
			temp+=t;
			temp+=")實施";
			temp+=reason;
			temp+="規則得到";
		}
		else{
			CString t;
			t.Format(_T("%d"),reason1);
			temp+=t;
			t.Empty();
			t.Format(_T("%d"),reason2);
			temp+="),(";
			temp+=t;
			temp+=")實施";
			temp+=reason;
			temp+="規則得到";
		}
		poof_procedure.push(temp);
	}
	else if(Detect(post,operat,op1,op2)){
		pre2.copy(pre);
		post2.copy(post);
		switch(operat){
			case '!':pre->Add(op1);
				     f1=Illation(pre,post,line,poof_procedure);
					 mystrcpy(reason,"├!");
					 break;
			case '*':post->Add(op1);
					 f1=Illation(pre,post,line,poof_procedure);
					 reason1=line-1;
					 post2.Add(op2);
					 f2=Illation(&pre2,&post2,line,poof_procedure);	
					 reason2=line-1;
					 mystrcpy(reason,"├*");
					 break;
			case '+':post->Add(op1);
					 post->Add(op2);
					 f1=Illation(pre,post,line,poof_procedure);
					 mystrcpy(reason,"├+");
					 break;
			case '>':pre->Add(op1);
					 post->Add(op2);
					 f1=Illation(pre,post,line,poof_procedure);
					 mystrcpy(reason,"├>");
					 break;
			case '=': pre->Add(op1);
					  post->Add(op2);
					  f1=Illation(pre,post,line,poof_procedure);
					  reason1=line-1;
					  pre2.Add(op2);
					  post2.Add(op1);
					  f2=Illation(&pre2,&post2,line,poof_procedure);
					  reason2=line-1;
					  mystrcpy(reason,"├=");
					  break;
		}
		CString temp;
		temp.Format(_T("(%d)    "),line++);
		pre1.print(temp);
		temp+="├";
		post1.print(temp);
		temp+="              是由(";
		if(operat=='!'||operat=='+'||operat=='>'){
			CString t;
			t.Format(_T("%d"),line-2);
			temp+=t;
			temp+=")實施";
			temp+=reason;
			temp+="規則得到";
		}
		else{
			CString t;
			t.Format(_T("%d"),reason1);
			temp+=t;
			t.Empty();
			t.Format(_T("%d"),reason2);
			temp+="),(";
			temp+=t;
			temp+=")實施";
			temp+=reason;
			temp+="規則得到";
		}
		poof_procedure.push(temp);
	}
	else{
		Node *temp=pre->first;
		while(temp!=NULL){
			if(post->Isin(temp->formula)){
			CString temp;
			temp.Format(_T("(%d)    "),line++);
			pre1.print(temp);
			temp+="├";
			post1.print(temp);
			temp+="              定理";
			poof_procedure.push(temp);
			break;
			}
			temp=temp->next;
		}
		if(temp==NULL)f1=0;
	}
	return f1*f2;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区蜜桃网| 日韩久久免费av| 亚洲精品日韩专区silk| 欧美专区亚洲专区| 亚洲一区二区三区在线播放| 欧美日韩免费电影| 国产成人亚洲综合a∨婷婷图片| 一区二区三区久久| 在线视频综合导航| 亚洲午夜久久久久久久久电影院| 欧洲国内综合视频| 另类小说色综合网站| 国产午夜精品一区二区三区四区| 波多野结衣中文字幕一区二区三区 | 精品国产凹凸成av人导航| 极品美女销魂一区二区三区| 中文字幕欧美区| 91久久免费观看| 老色鬼精品视频在线观看播放| 久久影院电视剧免费观看| 成人免费视频网站在线观看| 亚洲综合激情小说| 欧美精品一区二区不卡| 91网站最新地址| 日韩有码一区二区三区| 欧美高清在线视频| 91精品国产品国语在线不卡| 国产东北露脸精品视频| 亚洲精品视频免费观看| 日韩精品一区二区三区中文不卡 | 国产视频一区在线播放| 91论坛在线播放| 麻豆精品视频在线观看视频| 国产精品久久久久一区| 欧美一级一级性生活免费录像| 国产成人精品亚洲午夜麻豆| 亚洲国产精品尤物yw在线观看| 精品国产乱码久久久久久蜜臀| av电影一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎 | 亚洲一区二区3| 久久久久久久精| 欧美精品在线观看一区二区| 成人免费观看男女羞羞视频| 免费看欧美女人艹b| 亚洲精品免费播放| 国产欧美日韩综合精品一区二区| 精品视频1区2区3区| 东方欧美亚洲色图在线| 九九视频精品免费| 精品亚洲欧美一区| 视频一区在线播放| 亚洲欧美激情插| 国产精品午夜春色av| 精品久久久久久久一区二区蜜臀| 在线观看一区二区精品视频| 成人av免费在线观看| 韩国中文字幕2020精品| 日韩二区在线观看| 亚洲国产你懂的| 亚洲欧美视频一区| 中国av一区二区三区| 国产情人综合久久777777| 在线电影院国产精品| 在线免费观看不卡av| 99久久久无码国产精品| 成人黄色电影在线 | 国产不卡视频一区| 麻豆中文一区二区| 青青草视频一区| 亚洲尤物视频在线| 亚洲电影一区二区| 一区二区欧美国产| 一区二区三区av电影| 亚洲你懂的在线视频| 亚洲天堂中文字幕| 亚洲精品美国一| 樱花影视一区二区| 亚洲一区二区免费视频| 亚洲黄色在线视频| 一区二区三区四区视频精品免费 | 亚洲免费在线播放| 亚洲一区二区黄色| 亚洲第四色夜色| 日韩av在线播放中文字幕| 日日夜夜精品视频天天综合网| 亚洲成av人片在线| 蜜臀91精品一区二区三区| 免费成人深夜小野草| 久久99国产精品麻豆| 国产一区二区三区在线看麻豆| 国产一区二区三区不卡在线观看 | 国产乱人伦偷精品视频不卡| 国产精品一区2区| aaa亚洲精品一二三区| 99久久免费国产| 欧美三级视频在线播放| 日韩一区二区麻豆国产| 精品久久人人做人人爽| 久久精品视频一区| 亚洲天堂成人在线观看| 亚洲国产美国国产综合一区二区| 蜜桃一区二区三区四区| 国产白丝网站精品污在线入口| 91在线视频免费观看| 欧美日韩国产区一| 久久婷婷色综合| 亚洲视频在线观看一区| 亚洲一级不卡视频| 日本在线不卡视频| 丁香六月久久综合狠狠色| 在线精品国精品国产尤物884a| 91麻豆精品国产91久久久使用方法| 日韩精品在线看片z| 国产精品妹子av| 五月婷婷色综合| 激情文学综合丁香| 色综合久久88色综合天天| 91精品国产黑色紧身裤美女| 国产精品久久毛片| 青青青爽久久午夜综合久久午夜| 粉嫩在线一区二区三区视频| 精品视频全国免费看| 国产精品污网站| 日韩有码一区二区三区| 91蜜桃在线免费视频| 亚洲精品在线观看视频| 亚洲电影一区二区| 91在线精品一区二区三区| 日韩手机在线导航| 亚洲另类在线视频| 高清不卡一二三区| 日韩一区二区三区电影在线观看 | 国产精品蜜臀av| 久久99精品久久只有精品| 91国产免费看| 国产精品色在线| 激情图片小说一区| 在线成人小视频| 亚洲高清免费视频| 成人av中文字幕| 欧美日韩国产中文| 亚洲色图欧洲色图| 国产黄色91视频| 日韩欧美卡一卡二| 香蕉加勒比综合久久| 91视频.com| 国产亚洲一本大道中文在线| 奇米一区二区三区av| 色视频欧美一区二区三区| 中文字幕精品一区二区精品绿巨人| 另类小说综合欧美亚洲| 欧美日韩精品欧美日韩精品| 亚洲摸摸操操av| 成人国产精品视频| 国产日韩av一区二区| 国内成人免费视频| 欧美大胆人体bbbb| 久久精品二区亚洲w码| 欧美男男青年gay1069videost| 一区二区在线看| www.亚洲精品| 国产精品水嫩水嫩| 成人黄页毛片网站| 国产精品人成在线观看免费 | 国产精品网友自拍| 成人精品视频一区二区三区| 国产欧美视频在线观看| 国产成人免费在线观看| 日本一区二区在线不卡| 大陆成人av片| 国产精品视频在线看| 91色婷婷久久久久合中文| 成人欧美一区二区三区视频网页 | 亚洲成人一二三| 欧美日韩国产系列| 免费久久精品视频| 久久久无码精品亚洲日韩按摩| 国产毛片精品视频| 国产午夜精品久久久久久免费视 | 色综合久久综合网| 亚洲亚洲人成综合网络| 欧美日韩国产美女| 久久99久久久欧美国产| 久久久久久久久久久久电影| 成人美女在线观看| 亚洲精品日产精品乱码不卡| 欧美日韩一级大片网址| 日韩激情一二三区| 久久综合五月天婷婷伊人| 成人免费看黄yyy456| 亚洲卡通动漫在线| 日韩欧美国产午夜精品| 国产成人精品亚洲777人妖| 一区在线播放视频| 欧美丰满一区二区免费视频| 国产一区免费电影| 一区二区免费在线| 精品久久久久久无| 91免费版在线看|