-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
154 lines (148 loc) · 5.18 KB
/
main.cpp
File metadata and controls
154 lines (148 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include "global.hpp"
#include "little.hpp"
#include "nodeBT.hpp"
int main()
{
string fileName = "arkusz.txt";
int option = -1;
bool showCieties = true;
bool stepshow = false;
macierz data;
macierz dataFile;
static vector<vector<double>> Tab1 = {{INF, 1, 1, 2, 3}, {3, INF, 2, 5, 6}, {5, 4, INF, 3, 7}, {8, 4, 3, INF, 2}, {7, 7, 5, 6, INF}};
static vector<vector<double>> Tab2 = {{INF,8,7,5},{2,INF,6,4},{3,10,INF,4},{7,5,4,INF}};
static vector<vector<double>> Tab3 = {{INF, 7, 3, 6, 5, 2}, {4, INF, 8, 13, 5, 4}, {2, 1, INF, 16, 17, 19}, {18, 3, 25, INF, 2, 8}, {6, 10, 31, 23, INF, 7}, {3, 7, 4, 5, 6, INF}};
little problem;
while (option != 0)
{
dataFile.file(fileName);
system("cls");
cout << "==============================================================" << endl
<< "| Problem komiwojazera |" << endl
<< "==============================================================" << endl
<< endl
<< " Opcje:" << endl
<< "1. Reczne wprowadzanie danych" << endl
<< "2. Przykladowe zestawy danych " << endl
<< "3. Dane z pliku -> " << fileName << endl
<< "4. Ustawienia programu" << endl
<< endl
<< "0. Zakoncz" << endl
<< ">> ";
cin >> option;
system("cls");
switch (option)
{
default:
option = -1;
break;
case 0:
break;
case 1:
data.fill(showCieties);
problem.set(data);
problem.showArray(showCieties);
problem.stepOne();
problem.showGraph(showCieties);
problem.result2(showCieties);
system("PAUSE");
break;
case 2:
cout << " Wybierz ktory problem chcesz obliczyc:" << endl <<
"1. Macierz 4x4 - z ksiazki" << endl <<
"2. Macierz 5x5 - z zajec 1"<< endl <<
"3. Macierz 6x6 - z zajec 2"<< endl <<
endl <<
"0. Cofnij" << endl <<
">> " ;
cin >> option;
system("cls");
cout << " Macierz wejsciowa:" << endl;
switch (option) {
case 0:
option = -1;
break;
case 1:
problem.set(Tab1);
problem.showArray(showCieties);
system("PAUSE");
problem.stepOne();
problem.showGraph(showCieties);
problem.result2(showCieties);
system("PAUSE");
break;
case 2:
problem.set(Tab2);
problem.showArray(showCieties);
system("PAUSE");
problem.stepOne();
problem.showGraph(showCieties);
problem.result2(showCieties);
system("PAUSE");
break;
case 3:
problem.set(Tab3);
problem.showArray(showCieties);
system("PAUSE");
problem.stepOne();
problem.showGraph(showCieties);
problem.result2(showCieties);
system("PAUSE");
break;
default:
break;
}
break;
case 3:
if(dataFile.file(fileName))
{
problem.set(dataFile);
cout << " Macierz wejsciowa:" << endl;
problem.showArray(showCieties);
system("PAUSE");
problem.stepOne();
problem.showGraph(showCieties);
problem.result2(showCieties);
system("PAUSE");
}
else
{
cout << "Blad odczytu pliku " << fileName << endl;
system("PAUSE");
}
break;
case 4:
while(option != 0)
{
system("cls");
cout << " Ustawienia programu:" << endl;
cout << "1. Wyswietlaj nazwy z pliku city.txt -> " << (showCieties ? "Tak":"Nie") << endl <<
"2. Zmien nazwe pliku z danymi -> " << fileName << endl <<
"3. Wyswietlaj obliczenia krok po kroku -> " << (problem.getStepByStep() ? "Tak":"Nie") << endl <<
endl <<
"0. Cofnij" << endl <<
">> ";
cin >> option;
switch (option) {
case 1:
showCieties = not showCieties;
break;
case 2:
system("cls");
cout << "Podaj nazwe pliku z danymi >> ";
cin >> fileName;
break;
case 3:
stepshow = not stepshow;
problem.setStepByStep(stepshow);
break;
default:
break;
}
}
option = -1;
break;
}
}
return 0;
}