计算机网络课程设计报告_中国地质大学_武汉内容摘要:

if (temp[j][0] == ) break。 //防止多余插入 sign = 0。 for (i = 0。 i ()。 i++) { //若路由表中有该网络 if ((i,0) == temp[j][0]) { sign = 1。 //表示有该网络 if ((i,2) == temp[j][2])//若下一跳是 X,则替换 (i,1,temp[j][1])。 else//下一跳地址不是 X { if (atoi(temp[j][1].GetBuffer(0)) 12 atoi((i,1).GetBuffer(0))) { //若新距离小于原距离,则更新距离和下一跳地址 (i,1,temp[j][1])。 (i,2,temp[j][2])。 } } } } if (sign == 0) { LV_ITEM IvItem。 int nIndex = ()。 = LVIF_TEXT。 = nIndex。 = 0。 =。 (amp。 IvItem)。 (nIndex,0,temp[j][0])。 (nIndex,1,temp[j][1])。 (nIndex,2,temp[j][2])。 } } } if (nIDEvent == 2) { for (i = 0。 i 5。 i++) { for(j = 0。 j 3。 j++) temp[i][j] =。 } for(i = 0。 i ()。 i++) { temp[i][0] = (i,0)。 temp[i][1] = (i,1)。 temp[i][2] = (i,2)。 } i = 0。 while(temp[i][1] != ) { k = atoi(temp[i][1].GetBuffer(0))。 k++。 //距离加 1 temp[i][1].Format(%d,k)。 temp[i][2] = R1。 //下一跳改为 R1 13 i++。 } for (j = 0。 j 5。 j++) { if (temp[j][0] == ) { break。 //防止多余插入 } sign = 0。 for (i = 0。 i ()。 i++) { if ((i,0) == temp[j][0]) { sign = 1。 //表示有该网络 if ((i,2) == temp[j][2])//若下一跳地址是 X,则替换 (i,1,temp[j][1])。 else//下一跳地址不是 X { if (atoi(temp[j][1].GetBuffer(0)) atoi((i,1).GetBuffer(0))) { (i,1,temp[j][1])。 (i,2,temp[j][2])。 } } } } if (sign == 0) { LV_ITEM IvItem。 int nIndex = ()。 = LVIF_TEXT。 = nIndex。 = 0。 =。 (amp。 IvItem)。 (nIndex,0,temp[j][0])。 (nIndex,1,temp[j][1])。 (nIndex,2,temp[j][2])。 } } //R2 学习 R3 的路由表 for (i = 0。 i 5。 i++) { 14 for(j = 0。 j 3。 j++) temp[i][j] =。 } for(i = 0。 i ()。 i++) { temp[i][0] = (i,0)。 temp[i][1] = (i,1)。 temp[i][2] = (i,2)。 } i = 0。 while(temp[i][1] != ) { k = atoi(temp[i][1].GetBuffer(0))。 k++。 //距离加 1 temp[i][1].Format(%d,k)。 temp[i][2] = R3。 //下一跳改为 R1 i++。 } for (j = 0。 j 5。 j++) { if (temp[j][0] == ) break。 //防止多余插入 sign = 0。 for (i = 0。 i ()。 i++) { if ((i,0) == temp[j][0]) { sign = 1。 //表示有该网络 if ((i,2) == temp[j][2])//若下一跳地址是 X,则替换 (i,1,temp[j][1])。 else//下一跳地址不是 X { if (atoi(temp[j][1].GetBuffer(0)) atoi((i,1).GetBuffer(0)))。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。