C++ 无法在我的程序中获得所需的输出
我是C++ 无法在我的程序中获得所需的输出,c++,C++,我是c++的新手 #include <iostream> using std::cout; using std::endl; using namespace std; int main() { int a = 0; int b = 10; cout << "Enter first number \n"; cin >> a; if (a &
c++
的新手
#include <iostream>
using std::cout;
using std::endl;
using namespace std;
int main()
{
int a = 0;
int b = 10;
cout << "Enter first number \n";
cin >> a;
if (a < 10)
{
cout << "Less";
}
}
#包括
使用std::cout;
使用std::endl;
使用名称空间std;
int main()
{
int a=0;
int b=10;
cout>a;
如果(a<10)
{
cout这是因为您正在使用某种IDE,通常在IDE中,它们会显示一个包含您的输出的控制台框,当程序完成时,控制台框就会消失
正在显示,但控制台窗口退出太快,您无法看到它
您可以在末尾添加几行,例如:
#include <iostream>
#include <string>
using std::cout;
using std::endl;
using namespace std;
int main()
{
int a = 0;
int b = 10;
cout << "Enter first number \n";
cin >> a;
if (a < 10)
{
cout << "Less";
}
std::string pause;
cin >> pause;
}
#包括
#包括
使用std::cout;
使用std::endl;
使用名称空间std;
int main()
{
int a=0;
int b=10;
cout>a;
如果(a<10)
{
停顿;
}
请说明您是如何执行该程序的。描述应该足够了。这只是一种练习。当我输入5号控制台出口时……什么都没有发生……是缓存的程序吗?因为我已经反复编译了它。使用ctrl+F5使窗口保持打开状态。