Fix output display

This commit is contained in:
arpanjain97
2017-10-13 11:54:05 +05:30
parent 9cd56c01ad
commit 8b65482500
2 changed files with 12 additions and 4 deletions

View File

@@ -39,8 +39,12 @@ class Graph{
//Utility function to print distances
void print(int dist[], int V){
cout<<"\nVertex Distance"<<endl;
for(int i = 0; i < V; i++)
cout<<i<<"\t"<<dist[i]<<endl;
for(int i = 0; i < V; i++){
if( dist[i] != INT_MAX)
cout<<i<<"\t"<<dist[i]<<endl;
else
cout<<i<<"\tINF"<<endl;
}
}
//The main function that finds the shortest path from given source

View File

@@ -40,8 +40,12 @@ int minDistance(int mdist[], bool vset[], int V){
//Utility function to print distances
void print(int dist[], int V){
cout<<"\nVertex Distance"<<endl;
for(int i = 0; i < V; i++)
cout<<i<<"\t"<<dist[i]<<endl;
for(int i = 0; i < V; i++){
if( dist[i] != INT_MAX)
cout<<i<<"\t"<<dist[i]<<endl;
else
cout<<i<<"\tINF"<<endl;
}
}
//The main function that finds the shortest path from given source