roy floyd-grafuri orientate
#include<fstream.h>#include<conio.h>const float pinf=1.e20;float a[50][50];int n; void citire(char nume[20],float a[50][50],int& n){int i,j;float c;fstream f(nume,ios::in);f>>n;for(i=1;i<=n;i++) for(j=1;j<=n;j++) if (i==j) a[i][j]=0; else a[i][j]=pinf;while(f>>i>>j>>c) a[i][j]=c;f.close();} void drum(int i,int j){int k=1,gasit=0;while ((k<=n) && !gasit){ if ((i!=k) && (j!=k) && (a[i][j]==a[i][k]+a[k][j])) { drum(i,k);drum(k,j); gasit=1; } k++;}if (!gasit) cout<<j<<” “;} void tipar(int nodi,int nodf){if (a[nodi][nodf]<pinf){ cout<<“drumul de la “<<nodi<<” la “<<nodf<<” are lungimea … Read more