首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

编译好运行出错

2014-01-09 
编译好运行出错,求助#include stdafx.h#include iostream#include vector#include algorithm#incl

编译好运行出错,求助



#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <conio.h>

using namespace std;

int main(int argc, char **argv) 
{       
    int ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    vector<int> ivec(ia, ia+10);
    list<int> ilst;
    vector<int>::reverse_iterator rstart, rend;
    rstart = ivec.rbegin();
    for (int cnt1 = 1; cnt1 != 4; ++cnt1)
        ++rstart;
    for (int cnt2 = 1; cnt2 != 6; ++cnt2)
        ++rend;
copy(rstart, rend, inserter(ilst, ilst.begin() ));//这里的问题
    for (list<int>::iterator iter = ilst.begin(); iter != ilst.end(); ++iter)
        cout << *iter << endl;


    getch();
    return 0;
}


[解决办法]
rend好像没有初始化哦

热点排行