From 8b6a241faee1e0d9aac9281be7be883ba0332ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 21 Sep 2020 15:44:37 +0200 Subject: Initial solution L3 --- labb3/tsp/src/tsp.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'labb3/tsp/src/tsp.cpp') diff --git a/labb3/tsp/src/tsp.cpp b/labb3/tsp/src/tsp.cpp index 566bf7c..57de067 100644 --- a/labb3/tsp/src/tsp.cpp +++ b/labb3/tsp/src/tsp.cpp @@ -18,7 +18,16 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); - string filename = "tsp10.txt"; + // MY ADDITION + cout << "file: "; + string filename; + getline(cin, filename); + if (filename == "") { + filename = "tsp10.txt"; + } + // END OF ADDITION + + //string filename = "tsp100.txt"; ifstream input; input.open(filename); @@ -42,12 +51,12 @@ int main(int argc, char *argv[]) { double y; while (input >> x >> y) { Point p(x, y); - tour.insertNearest(p); - //uncomment the 4 lines below to animate - //tour.draw(scene); - //std::chrono::milliseconds dura(50); - //std::this_thread::sleep_for(dura); - //a.processEvents(); + tour.insertSmallest(p); + // uncomment the 4 lines below to animate + // tour.draw(scene); + // std::chrono::milliseconds dura(50); + // std::this_thread::sleep_for(dura); + // a.processEvents(); } input.close(); -- cgit v1.2.1