崩溃,我有这个简单的C++程序C++程序在运行时
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <vector>
using namespace std;
int aleator(int n)
{
return (rand()%n)+1;
}
int main()
{
int r;
int indexes[100]={0};
// const int size=100;
//int a[size];
std::vector<int>v;
srand(time(0));
for (int i=0;i<25;i++)
{
int index = aleator(100);
if (indexes[index] != 0)
{
// try again
i--;
continue;
}
indexes[index] = 1;
cout << v[index] ;
}
cout<<" "<<endl;
system("pause");
return 0;
}
但在运行时它崩溃了,所以我就用“发送错误报告”和“不发送”的错误。我做错了什么?谢谢!
如果它在任何其他时间坠毁,这将是有趣的。 – 2010-06-05 19:40:28