为什么我不能用vector,下面德程序有什么不对吗?
#include <vector>
#include <algorithm>
#include <iostream>
int ia[ 10 ] = {
51, 23, 7, 88, 41, 98, 12, 103, 37, 6 };
int main()
{
vector< int > vec( ia, ia+10 );
// 排序数组
sort( vec.begin(), vec.end() );
// 获取值
int search_value;
cin >> search_value;
// 搜索元素
vector<int>::iterator found;
found = find( vec.begin(), vec.end(), search_value );
if ( found != vec.end() )
cout << "search_value found!\n";
else cout << "search_value not found!\n";
// 反转数组
reverse( vec.begin(), vec.end() );
// ...
}