exe文件中缺少输出
Missing ouptut in exe file
我正在使用以下 C++ 代码输入 X 的值,该值用于打印变量 CDF。此 C++ 代码预计会提供与我们从 excel 中的 NORMDIST 函数获得的非常相似的值。但是,我在调试器中遇到以下错误,但没有在可执行文件中获取任何输出。任何人都可以帮忙吗?
#include<iostream>
#include<cmath>
using namespace std;
const double pi = 4.0*atan(1.0);
int main()
{
const double a1 = 0.319381530, a2 = -0.356563782, a3 = 1.781477937,
a4 = -1.821255978, a5 = 1.330274429;
double X = 0, x = 0; double k = 0;
double N, CDF, n;
cout << "Enter the value of the random variable X" << endl;
cin >> X;
x = fabs(X);
k = 1 / (1 + 0.2316419*x);
n = (1 / sqrt(2 * pi))*exp(-0.5*x*x);
N = 1 - n*(a1*k + a2*k*k + a3*pow(k, 3) + a4*pow(k, 4) + a5*pow(k, 5));
CDF = N;
if (X < 0)
CDF = 1 - N;
cin.clear();
cout << CDF;
cin.get();
return 0;
}
I CDF1.exe 用于输出,例如 X= 0.7693 作为输入,我期待 0.7791,但我在 CDF1.exe 中看不到任何输出,我只在调试器中看到下面的内容。有人可以帮忙解决问题吗?
'CDF1.exe' (Win32): Loaded 'C:\Users\kdatta\Documents\CQF\C++\CDF1 Debug\CDF1.exe'. Symbols loaded.
'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Cannot find or open the PDB file.
'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Cannot find or open the PDB file.
The thread 0x4fc0 has exited with code -1073741749 (0xc000004b).
The program '[11216] CDF1.exe' has exited with code -1073741510 (0xc000013a).
问题是在调试模式下,代码 returns 立即生效,您看不到结果。当您处于调试模式时,您必须强制程序暂停。你可以把 system("pause")
#include<iostream>
int main()
{
std::cout << "hello world\n";
#ifdef _DEBUG
system("pause");
#endif
return 0;
}
PDB 文件包含调试信息。这些是警告而不是错误。尝试通过重建项目来摆脱它们。
此外,单击“项目”->“属性”,确保您具有以下设置:
C/C++ -> General -> Program Database for Edit And Continue (/ZI)
Linker -> Debugging -> Generate Debugging Info = Yes
我正在使用以下 C++ 代码输入 X 的值,该值用于打印变量 CDF。此 C++ 代码预计会提供与我们从 excel 中的 NORMDIST 函数获得的非常相似的值。但是,我在调试器中遇到以下错误,但没有在可执行文件中获取任何输出。任何人都可以帮忙吗?
#include<iostream>
#include<cmath>
using namespace std;
const double pi = 4.0*atan(1.0);
int main()
{
const double a1 = 0.319381530, a2 = -0.356563782, a3 = 1.781477937,
a4 = -1.821255978, a5 = 1.330274429;
double X = 0, x = 0; double k = 0;
double N, CDF, n;
cout << "Enter the value of the random variable X" << endl;
cin >> X;
x = fabs(X);
k = 1 / (1 + 0.2316419*x);
n = (1 / sqrt(2 * pi))*exp(-0.5*x*x);
N = 1 - n*(a1*k + a2*k*k + a3*pow(k, 3) + a4*pow(k, 4) + a5*pow(k, 5));
CDF = N;
if (X < 0)
CDF = 1 - N;
cin.clear();
cout << CDF;
cin.get();
return 0;
}
I CDF1.exe 用于输出,例如 X= 0.7693 作为输入,我期待 0.7791,但我在 CDF1.exe 中看不到任何输出,我只在调试器中看到下面的内容。有人可以帮忙解决问题吗?
'CDF1.exe' (Win32): Loaded 'C:\Users\kdatta\Documents\CQF\C++\CDF1 Debug\CDF1.exe'. Symbols loaded. 'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file. 'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file. 'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file. 'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Cannot find or open the PDB file. 'CDF1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Cannot find or open the PDB file. The thread 0x4fc0 has exited with code -1073741749 (0xc000004b). The program '[11216] CDF1.exe' has exited with code -1073741510 (0xc000013a).
问题是在调试模式下,代码 returns 立即生效,您看不到结果。当您处于调试模式时,您必须强制程序暂停。你可以把 system("pause")
#include<iostream>
int main()
{
std::cout << "hello world\n";
#ifdef _DEBUG
system("pause");
#endif
return 0;
}
PDB 文件包含调试信息。这些是警告而不是错误。尝试通过重建项目来摆脱它们。
此外,单击“项目”->“属性”,确保您具有以下设置:
C/C++ -> General -> Program Database for Edit And Continue (/ZI)
Linker -> Debugging -> Generate Debugging Info = Yes