summaryrefslogtreecommitdiff
path: root/graphs/task1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'graphs/task1.cpp')
-rw-r--r--graphs/task1.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/graphs/task1.cpp b/graphs/task1.cpp
index 62806ae..1fea795 100644
--- a/graphs/task1.cpp
+++ b/graphs/task1.cpp
@@ -10,11 +10,16 @@ void print(graph g)
for (int i = 0; i < int(g.size()); ++i)
{
cout << i + 1 << ": ";
- for (auto node : g[i])
- cout << node + 1 << ", ";
- cout << endl;
- }
+ for (int j = 0; j < int(g[i].size()) - 1; ++j)
+ cout << g[i][j] + 1 << ", ";
+
+ if (g[i].size() > 0)
+ cout << g[i].back() + 1;
+ else
+ cout << "нет смежных вершин";
+ cout << ";" << endl;
+ }
}
int main()