当前位置: > 用C或C++编写程序,要求:输入命题公式,给出它的主合取范式和主析取范式....
题目
用C或C++编写程序,要求:输入命题公式,给出它的主合取范式和主析取范式.
用C或C++编写程序,要求:
输入命题公式,给出它的主合取范式和主析取范式.
例如运行时,从键盘输入:
p∧q∨r
程序能根据这个输入求出主析取范式:
p∧!q∧r) ∨(!p∧q∧r) ∨(p∧!q∧r) ∧p∧q∧!r) ∨(p∧q∧r)
同样得到主合取范式,∨可用or或&代替,∧可以用and 或&&代替
输入:(p->q)->q
得到主析取范式:(p∧!q)∨(!p∧q)∨(p∧q)
p∨q∨r (主合取范式)
以下是原题:
1、设计并开发一个能帮助学习数理逻辑的小软件.
2、结合离散数学的相关知识,掌握VC等集成开发环境,开发一个能辅助教学的小软件.
1、输入命题公式,该软件能判断公式的类型,并列出真值表.
2、输入命题公式,给出它的主合取范式和主析取范式.
1、使用VC等集成开发环境设计并开发出一个辅助教学的小软件.
2、能够对命题公式的类型做出判断,能列出真值表,写出主范式.
3、有能力者可扩充数理逻辑的其他内容,譬如推理系统的构造和证明,求谓词公式的前束范式等.

提问时间:2021-03-04

答案
A-Z + is OR * is AND _ is → # is♁(圆圈里加个+) @ is ⊙
$ is ↑ 命题的"与非" 运算( "与非门" )
% is ↓ 命题的"或非"运算( "或非门" )
Input the source formula:
A*!S+R
Here!
8countTerms
NORMALc:(A*!S*!R)+(!A*!S*R)+(A*!S*R)+(!A*S*R)+(A*S*R)
NORMALd (A+S+R)*(A+!S+R)*(!A+!S+R)
!A+S*!R
Input the source formula:
(!A+B)_R
Here!
8countTerms
NORMALc:(!A*!B*!R)+(A*!B*!R)+(!A*B*!R)+(A*B*!R)+(!A*!B*R)+(!A*B*R)+(A*B*R)
NORMALd (!A+B+!R)
Error!
Input the source formula:
A#B
Here!
4countTerms
NORMALc:(A*!B)+(!A*B)
NORMALd (A+B)*(!A+!B)
Error!
Input the source formula:
A@B
Here!
4countTerms
NORMALc:(!A*!B)+(A*B)
NORMALd (!A+B)*(A+!B)
Error!
#include
#include
#include
#include
using namespace std;
class formulaBase
{
private:
int numVar;//The number of the variables in the formula
bool variables[100];//To store the value of the variables
string sourceFormula;
string normalCFormula;
string normalDFormula;
string dualFormula;
vector vctofVar;
vector vctofPoland;
stack stk;
bool isVar(char ch)const;
void addMin(int minterm);
void addMax(int maxterm);
bool compute(int minterm);
void getInversePoland();
int countTerms(int n);
void assign(int minterm);
stack boolStk;
public:
formulaBase();
formulaBase(const formulaBase& rhs);
formulaBase();
void getSource();
string generateNormalC();
string generateNormalD();
string getDual();
void printSource()const{cout
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.