mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-09 05:27:11 +08:00
Fix output display
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user