【发布时间】:2018-12-04 09:43:37
【问题描述】:
我一直在学习 C++ Primer Plus,我正在使用 Visual Studio Code 解决其中的编程挑战,因为 Visual Studio 2017 存在一些奇怪的问题。我看过很多其他类似的帖子,但那里的解决方案没有不适合我。例如,我尝试在 main() 函数的右花括号处放置一个断点,在 return 0 之前将 cin.ignore() 放在末尾。但这些都不起作用。这是代码。
#include <iostream>
using namespace std;
int main() {
int inInput;
cout << "Enter your height in inches." << endl;
cin >> inInput;
int feet = inInput/12;
int inches = inInput%12;
cout << feet << inches << " is your height." << endl;
cin.ignore();
return 0;
}
编辑:
尝试了将其标记为重复的解决方案,但没有成功。
【问题讨论】:
-
您是否在 Debug 中构建了您的程序?
-
Googling the title of your question 在第一个链接中给了我答案;)
-
1st 我在调试中构建时没有任何反应,它只是打开首选项@MichałWalenciak
-
@FourFrame 我很难想象构建一个项目会如何打开偏好...
-
如果你想编写控制台程序,你应该从控制台运行它们。
标签: c++ input visual-studio-code user-input