小编min*_*t93的帖子

自动化定理证明程序 - 从哪里开始?

我是二年级学生,我的离散数学 2 作业是制作一个自动定理证明器。我必须在 4 周内制作一个适用于命题逻辑的简单证明程序(假设证明始终存在)。到目前为止,我已经用谷歌搜索过,但 4 周后,那里的材料真的很难理解。谁能给我推荐一些适合初学者的书籍/网站/开源代码或一些有用的提示?先感谢您。

logic theorem-proving

5
推荐指数
1
解决办法
2268
查看次数

scanf没有进入长双

我有扫描函数在下面的代码中读取long double的问题:

(请原谅我可怜的英文)

#include <iostream>
#include <cstdlib>
#include <math.h>
using namespace std;
int main()
    {
    int n;
    scanf("%d",&n);
    long double a,b,c,ha,hb,hc,ma,cosa,r,l,res,area;
    for (int i=0;i<n;i++)
    {
        scanf("%Lf %Lf %Lf %Lf",&a,&ha,&hb,&hc);//this is where the problem lies,
  //i need to read 4 long double a,ha,hb,hc
        printf("%Lf %Lf %Lf %Lf\n",a,ha,hb,hc);//but it returned wrong answer so
  //i used printf to check, ps: the code works with float but not with double or
  //long double
        ha*=3;hb*=3;hc*=3;
        c=(a*ha)/hc; b=(a*ha)/hb;
        ma=sqrt(0.5*b*b+0.5*c*c-0.25*a*a);
        cosa=ha/ma;
        r=(2*ma)/3;
        l=b*(b-sqrt(a*a-hb*hb))/ha;
        res=sqrt(l*l+r*r-2*cosa*l*r);
        area=a*ha/2;
        printf("%.3Lf %.3Lf\n",area,res); …
Run Code Online (Sandbox Code Playgroud)

c++ mingw

3
推荐指数
2
解决办法
2万
查看次数

标签 统计

c++ ×1

logic ×1

mingw ×1

theorem-proving ×1