-2
C 코드에서 : 나는 노드 또는 소스에 확률의 임의의 값을 할당 할 때경고 : EXC_Arithmetic (코드 = EXC_1386_DIV, 서브 코드 = 0x0으로) 나는이 C 코드를 작성했습니다
printf("The source node %d is \n", source);
for(i=0; i<V; i++){ //Each node has books+papers*c[t]
t=0;
c[t]=0.5;
books[i]=1000.;
papers[i]=10;
items[i][t]=books[i]+papers[i]*c[t]; // Initial items
}
for(i=0;i<V;i++){
printf("Items[%d][%d] are %.2f\n",i,t, items[i][t]);
}
for(i=0;i<V;i++){
if(i!=source) { // Assign a random value of probability in the range [0.1,0.4] to the nodes, except the source
prob_items[i]=rand()%(5/10);
} else prob_items[i]=rand()%(3/10); // Assign a random value of probability in the range [0.6,0.9] to the source
}
do {
printf("Please randomly select a lucky node\n");
lucky=rand()%V; //V are the vertices of the graph
} while (lucky!=source);
을, 내가 가진 그 오류. 물론 잘못된 것이 있습니다. 노드 (예 : 행운의 노드) 중 하나를 내 소스와 비교하기 위해 노드와 선택한 소스 (소스라고 함)에 서로 다른 두 개의 값을 할당하려고합니다.
도와 주시겠습니까? 고맙습니다.
으로 분할하여 예제 프로그램 ([mcve]); ** ** 또한 어쩌면 경고/오류를 어떤 행에 표시 할지도 모릅니다. – anatolyg