C++求素数哪里错了啊......
#include <iomanip>
#include <vector>
#include <iostream>
using namespace std;
int main()
{
vector <int> num;
vector <int> sentence;
typedef vector<int>::iterator lter;
lter beg;
int i=0 ,j=0;
for (i=2;i<300;i++)
{
num[i] = i;
}
for(i=2; i<300;i++)
{
for (beg = num.begin(); beg != num.end();++beg)
{
if (*beg%num[i]==0)
sentence.erase(beg);
else
num[i]= *beg;
}
}
for(i=2;i<300;i++)
cout << num[i]<<endl;
return 0;
}
算法那里出错了? 没有反应呀!