我是 C++ 的新手,事实上这是我在大学里的第一份作业
我的问题是,我写了我认为可以工作的东西,但在没有调试的情况下运行似乎并不能使它工作,本地调试会跳过我在代码上设置的所有断点。我不认为这是代码的问题,也许是软件问题,但无论如何这是代码。
#include <iostream>;
using namespace std;
//using namespace std;
// Declare named constants, as necessary.
const double CENTIMETERS_PER_INCH = 2.54;
const int INCHES_PER_YARD = 36;
const int INCHES_PER_FOOT = 12;
int main()
{
// Declare named variables, as necessary.
double inputCentimeters;
int inches;
int feet;
int yards;
// Executable statement(s).
cout << "Give me a length in centimeters: ";
cin >> inputCentimeters;
cout << endl;
inches = static_cast<int>((inputCentimeters + 0.5) / CENTIMETERS_PER_INCH);
yards = inches / INCHES_PER_YARD;
inches = inches % INCHES_PER_YARD;
feet = inches / INCHES_PER_FOOT;
inches = inches % INCHES_PER_FOOT;
cout << yards << " yard(s),"
<< feet << " feet (foot),"
<< inches << " inch(es).";
return 0;
}
我在 Windows 8 上运行 Microsoft Visual Studio 11
最佳答案
启动应用程序有两种方式:带调试和不带调试。 在不调试的情况下启动时,不附加调试器。如果应用程序运行时没有附加调试器,它不会命中断点,也不会发出调试消息。
您可以在此处阅读更多内容。还有一些屏幕截图可能会有所帮助:
http://blogs.msdn.com/b/zainnab/archive/2010/11/01/start-debugging-vs-start-without-debugging-vstipdebug0037.aspx
关于c++ - 调试不会在断点处停止?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28315644/