summaryrefslogtreecommitdiff
path: root/Es6.cpp
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-03-17 21:00:23 +0100
committerGitHub <noreply@github.com>2017-03-17 21:00:23 +0100
commiteff9b7e3ac6f894e03d644bfba564909a260794c (patch)
tree18772921408e1231f7f4f4088d875e22fe17b70c /Es6.cpp
parent47a54787726a158f89c4f0a0301cb2d80b55e267 (diff)
Grafi
Diffstat (limited to 'Es6.cpp')
-rw-r--r--Es6.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/Es6.cpp b/Es6.cpp
new file mode 100644
index 0000000..9907eb9
--- /dev/null
+++ b/Es6.cpp
@@ -0,0 +1,38 @@
+#include <iostream>
+#include <algorithm>
+using namespace std;
+/* run this program using the console pauser or add your own getch, system("pause") or input loop */
+
+int main(int argc, char** argv) {
+ int v=5;
+ int matrice[v][v];
+ for (int i=0;i<v;i++)
+ {
+ for (int j=0;j<v;j++)
+ matrice[i][j]=9999;
+ }
+ for (int i=1;i<v;i++) matrice[i][i]=0;
+ matrice[1][4]=5;
+ matrice[1][2]=1;
+ matrice[2][3]=2;
+ matrice[3][1]=2;
+ matrice[3][4]=1;
+ matrice[4][1]=3;
+ for (int h=1;h<v;h++)
+ {
+ for (int i=1;i<v;i++)
+ {
+ for (int j=1;j<v;j++)
+ {
+ matrice[i][j]=min(matrice[i][j],matrice[i][h]+matrice[h][j]);
+ }
+ }
+ }
+ for (int i=1;i<v;i++)
+ {
+ for (int j=1;j<v;j++)
+ cout<<matrice[i][j]<<" ";
+ cout<<endl;
+ }
+ return 0;
+}