|
|
back to boardHelp me! Please! Why I always got "Crash!!!ACCESS_VIOLATION"??????????????????????????????? Posted by zsuhoo 4 Sep 2004 01:38 What does "Crash!!!ACCESS_VIOLATION" mean?? Why this problem happen??? How to settle it??? Thanks!!! Source code: #include<iostream.h> unsigned long int is_prime(unsigned long int x) { unsigned long int mid=x/2+1,y; for(y=2;y<mid;y++) { if(x%y==0)return 0; } return 1; } unsigned long int prime_k(unsigned long int k) { unsigned long int count,l; for(l=2,count=0;count<k;) { if(is_prime(l)) { count++; l++; } else l++; } l--; return l; } int main() { unsigned long int num,a[100],i,prime,m; cin>>num; for(i=0;i<num;i++) { cin>>a[i]; } for(i=0;i<num;i++) { m=a[i]; prime=prime_k(m); m=num-1; if(i==m)cout<<prime; else cout<<prime<<" "; } } Re: Help me! Please! Why I always got "Crash!!!ACCESS_VIOLATION"??????????????????????????????? Need increase array "unsigned long a[100]" to 15001 |
|
|