C++ Visual studio 2013 C++;标准库
我正在使用visual studio 2013用c++编写以下代码:C++ Visual studio 2013 C++;标准库,c++,visual-studio,C++,Visual Studio,我正在使用visual studio 2013用c++编写以下代码: #include <iostream> using namespace std; int main() { std::cout << "Please enter two integers: " << std::endl; int v1 = 0, v2 = 0; std::cin >> v1 >> v2; int current
#include <iostream>
using namespace std;
int main()
{
std::cout << "Please enter two integers: " << std::endl;
int v1 = 0, v2 = 0;
std::cin >> v1 >> v2;
int current = std::min(v1, v2);
int max = std::max(v1, v2);
while (current <= max)
{
std::cout << current << std::endl;
++current;
}
return 0;
}
#包括
使用名称空间std;
int main()
{
标准::cout v1>>v2;
int电流=标准::最小值(v1,v2);
int max=std::max(v1,v2);
而(当前在我看来,你好像忘了#包括
您的代码应该如下所示:
#include <iostream>
#include <algorithm> // notice this
using namespace std;
int main()
{
std::cout << "Please enter two integers: " << std::endl;
int v1 = 0, v2 = 0;
std::cin >> v1 >> v2;
int current = std::min(v1, v2);
int max = std::max(v1, v2);
while (current <= max)
{
std::cout << current << std::endl;
++current;
}
return 0;
}
#包括
#包括//注意这一点
使用名称空间std;
int main()
{
标准::cout v1>>v2;
int电流=标准::最小值(v1,v2);
int max=std::max(v1,v2);
而(当前Add)
<代码> >包含< < /p> >将<代码>包含代码> <代码>。重点是(不幸的非常小的文本)“在页眉<代码> <代码>中定义的”我通过Google“C++ Min和max”找到答案。为什么不能?LOL -我Google C++ STD Min和Max,这是热门的。
#include <algorithm>