尝试对整数数组进行排序,经过一些谷歌搜索后,遇到了std::sort这个错误,遇到了解决方案:namespace "std" has no member "sort".
只是为了消除我没有使用std命名空间的任何疑虑,这里是我的标题:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
Run Code Online (Sandbox Code Playgroud)
hmj*_*mjd 37
加:
#include <algorithm>
Run Code Online (Sandbox Code Playgroud)
如std::sort()参考页中所述.
请参阅使用std命名空间,为什么"使用命名空间std"被认为是不好的做法?关于SO讨论的许多其他问题using namespace std;.