Debug Assertion Failed!


I`m executing a program given below...but an error displayed at the beginning

Debug Assertion Failed!
Program:...dio
2010\projects\cucconi_analysis\Debug\cucconi_analysis.exe
File c:\program files(x86)\mirosoft visual studio 10.0\vc\include\vector
Line:932
Expression:vector subscript out of range

please help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
  #include<iostream>
#include<random>
#include<math.h>
#include<list>
#include<ctime>
#include<vector>
#include <cstdlib>
#include "ranker.h"
int main()
{
	clock_t t1,t2;
	t1=clock();        //Start Time

	string method="average";
	double Sum=0;
	double sumSquare=0;
	double ucl=4.26;
	int m=30,n=5;
	int k=m+n;
	int rpt=100000;
	double s2,p,q,q1,U,v,e,f,r,st;
	std::list<double> setvalue;
	vector <double> first(35);
	vector <double> Ranks(35);
	std::default_random_engine generator;
    std::normal_distribution<double> distribution(0,1);
	for(int i=1;i<=rpt;i++)
	{
		for(int u=1;u<=30;u++)
		{
			first[u]=distribution(generator);
		}
		for(int j=1;j<=1000000;j++)
		{
			for(int k=31;k<=35;k++)
			{
				first[k]=distribution(generator);
			}
			rank(first,Ranks,method);
			for(int t=31;t<=35;t++)
			{
				Sum=Sum+first[t];
				sumSquare=sumSquare+(first[t]*first[t]);
			}
			s2=n*(k+1)*(k+1)-2*(k+1)*Sum+sumSquare;
			p=n*(k+1)*((2*k)+1);	
	        q=((m*n)*(k+1)*(2*k+1)*(8*k+11))/5;
			q1=sqrt(q);
	        U=((6*sumSquare)-p)/q;
	        v=((6*s2)-p)/q;
	        e=2*(k*k-4);
	        f=(2*k+1)*(8*k+11);
	        r=(e/f)-1;
            st=((U*U+v*v-2*r*U*v)/(2*(1-r*r)));
			if(st>ucl)
			{
				setvalue.push_back (j);
				double Sum=0;
				int count=0;
				double mean;
				for (std::list<double>::iterator it=setvalue.begin(); it != setvalue.end(); ++it)
				{
					Sum=Sum+(*it);
					count++;
				}

				mean=Sum/count;
				std::cout<<"Mean:"<<mean<<'\n';
				break;

			}
			else
				setvalue.push_back(0);
	        
		}

	}
	t2=clock();
    float diff=((float)t2-(float)t1)/1000;
    std::cout<<"elapsed time:"<<diff<<" sec"<<'\n';

	return 0;
}
Last edited on
Topic archived. No new replies allowed.