summaryrefslogtreecommitdiff
path: root/cpp/Es6.cpp
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-04-26 16:37:39 +0200
committerSanto Cariotti <sancn@live.com>2017-04-26 16:37:39 +0200
commit483d63fa7249ad8d6020680c48c3cf6df35010b3 (patch)
tree2f8649e3ae6b42ace5011246285c9c450f004222 /cpp/Es6.cpp
parent6c957dc4e01aee6ce9cae3c8342d04b0fd9ca9c4 (diff)
Moved all C++ files into CPP folder
Diffstat (limited to 'cpp/Es6.cpp')
-rw-r--r--cpp/Es6.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/cpp/Es6.cpp b/cpp/Es6.cpp
new file mode 100644
index 0000000..9907eb9
--- /dev/null
+++ b/cpp/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;
+}