[英]Visual Studio 2015 - Local Windows Debugger closes out immediately after run?
Hi I'm a highschool student in need of help. 嗨,我是一名需要帮助的高中生。 I am interested in C++ as I wish to become a programmer one day. 我对C ++感兴趣,因为我希望有一天成为一名程序员。 I started using Visual Studio for C++ and I'm running a few simple lines of code. 我开始使用Visual Studio for C ++,并且正在运行一些简单的代码行。 But everytime I press (Ctrl + F5) or Local Windows Debugger it shows my line of code but it closes out immediately after it runs, making it near impossible to read. 但是每次我按(Ctrl + F5)或Local Windows Debugger时,它都会显示我的代码行,但运行后立即关闭,几乎无法读取。 The code is the classic "Hello World!" 该代码是经典的“ Hello World!” code. 码。 Maybe it has to do something with return 0;? 也许它必须对return 0做点什么?
EDIT: Here's my code. 编辑:这是我的代码。
#include <iostream>
using namespace std;
int main()
{
int mark = 90;
if (mark < 50) {
cout << "HES OLD" << endl;
}
else {
cout << "Hes not old!" << endl;
}
}
When making console applications, I use the following lines at the end of my main
function: 在制作控制台应用程序时,我在main
功能的末尾使用以下几行:
std::cout << "\nPaused. Press Enter to continue.\n";
std::cin.ignore(100000, '\n');
The idea is to display a prompt and then wait for the Enter key to be pressed. 这个想法是显示一个提示,然后等待按下Enter键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.