PDA

View Full Version : سوال: مشکل در برنامه الگوریتم دیکسترا



nima_loya
دوشنبه 07 تیر 1389, 12:41 عصر
با سلام و خسته نباشید به اساتید محترم
من در انتهای برنامه الگوریتم دکسترا با مشکل مواجه شدم چون وزن(w) , وpوt رو درست چاپ نمی کنه لطفا بررسی و اشکالات ان و برام بگین با تشکر


#include <iostream.h>
#include <conio.h>
#include <string.h>
main()
{
int a[10][10];int x,y,n;int w=0;
char b[100],p[100],t[100];int i=1;
cout<<"{taedad rasha} ";
cin>>n;
cout<<"rasha V={";
for(x=0;x<n;x++)
{cin>>b[x];cout<<',';}
cout<<'}'<<'\n';
for (x=0;x<n;x++)
{for(y=0;y<n;y++)
{cout<<"enter ["<<b[x]<<','<<b[y]<<"] ";cin>>a[x][y];}
cout<<'\n';}
cout<<"P={"<<b[0]<<"}\n";
cout<<"T={";
for(x=1;x<n;x++)
cout<<b[x]<<",";
cout<<"}\n";
for (x=0;x<n;x++)
{for(y=0;y<n;y++)
{if ((a[x][y]>0) && (a[x][y]<min))
min=a[x][y];}
w+=min;
cout<<"L(t)="<<w<<"\n";
cout<<"x={"<<b[y]<<"\n"<<"P'=P+{x}"<<"\n";
cout<<"T'=T-{x} \n";
}



getch();
return 0;
}

behzadboloori
دوشنبه 07 تیر 1389, 13:23 عصر
عزیز من اینجا مربوط به C++ Biulder هست.