Missing ouptut in exe file

0

I am using following C++ code to enter a value of X which is used to print out variable CDF. This C++ code is expected to give very similar value we get from NORMDIST function in excel. However I get following error in debugger with out getting any output in executable file. Can any body help please?

#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 for output for example for X= 0.7693 as input, I am expecting 0.7791 but I don't see any output in CDF1.exe and I just see below in debugger. Can anybody help in trouble shoot please?

'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).
debugging
visual-c++
asked on Stack Overflow Jun 26, 2015 by Kausik • edited Jun 27, 2015 by Kausik

1 Answer

0

The problem is that in debug mode the code returns immediately and you don't see the result. You have to force the program to pause when you are in debug mode. You can put system("pause")

#include<iostream>
int main()
{
  std::cout << "hello world\n";

#ifdef _DEBUG
  system("pause");
#endif

  return 0;
}

PDB files contain debug information. Those are warnings not errors. Try to get rid of them by rebuilding the project.

Also, click Project -> Properties, make sure you have these settings:

C/C++ -> General -> Program Database for Edit And Continue (/ZI)

Linker -> Debugging -> Generate Debugging Info = Yes

answered on Stack Overflow Jun 27, 2015 by Barmak Shemirani • edited Jun 27, 2015 by Barmak Shemirani

User contributions licensed under CC BY-SA 3.0