Why this code shows me an error on line 31 for
cout<<x1<<x2
;
//This code is used to define a tree.
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
vector<vector<int>> Tree;
int edge, n1, n2; //edges for the tree
cin >> edge;
Tree.resize(edge);
for (int i = 0; i < edge; i++)
{
cin >> n1 >> n2;
Tree[n1].push_back(n2);
}
for (auto x1 : Tree)
{
for (auto x2 : x1)
{
cout << x1 << x2; //Here, it shows error
}
cout << endl;
}
return 0;
}
Could you please explain briefly where am I wrong. Also this is my first question, so please dont be harsh on me.