C++ Visual Studio似乎忽略了我的IF函数
我一直在尝试为即将到来的任务练习一小部分代码,但就我的一生而言,我无法让visual studio认识到有一个C++ Visual Studio似乎忽略了我的IF函数,c++,visual-studio-2010,C++,Visual Studio 2010,我一直在尝试为即将到来的任务练习一小部分代码,但就我的一生而言,我无法让visual studio认识到有一个if函数,它只是完全跳过了它。我一按回车键窗口就关闭了 #include <iostream> using namespace std; int main() { int a, b; cout << "Enter first number."; cin >> a; cout << "Enter secon
if
函数,它只是完全跳过了它。我一按回车键窗口就关闭了
#include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Enter first number.";
cin >> a;
cout << "Enter second number.";
cin >> b;
if( a > b)
{
cout << "Variable a is greater than variable b." << endl;
cout << "Value of a is " << a << " value of b is " << b << endl;
}
return 0;
}
#包括
使用名称空间std;
int main()
{
INTA,b;
cout>a;
cout>b;
如果(a>b)
{
不能移植,但是,当您使用Visual Studio时,您在Windows上,所以它可以工作。当您在调试模式下使用Visual Studio时,您不需要向程序中添加系统(“暂停”)或其他内容。所以我猜您是在发布模式下工作的
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Enter first number.";
cin >> a;
cout << "Enter second number.";
cin >> b;
if( a > b)
{
cout << "Variable a is greater than variable b." << endl;
cout << "Value of a is " << a << " value of b is " << b << endl;
}
system("pause");
return 0;
}
#包括
#包括
使用名称空间std;
int main()
{
INTA,b;
cout>a;
cout>b;
如果(a>b)
{
无论如何都不要尝试打印a和b,看看实际值是什么。您的输入中可能发生了导致意外行为的事情。我可以消除您的恐惧:您的IF
语句非常好。当程序完成执行时,窗口将关闭。因为程序在若
语句执行完毕,她就写了这么多。尝试用Ctrl+F5启动