I'm kinda new in C++ and when trying to compile this code I get and error that I do not know how to fix:
int main()
{
typedef pair<int,int> nodo;
int x;
cin >> x;
int *g;
g = new int[x];
vector <nodo> g;
g[1].push_back(nodo(2,5));
g[1].push_back(nodo(3,10));
g[3].push_back(nodo(2,12));
g[2].push_back(nodo(4,1));
g[4].push_back(nodo(3,2));
for (int i = 1; i <=4; ++i){
// cout << i << " -> ";
for (int j = 0; j<g[i].size(); ++j){
// cout << g[i][j].first << " c: " << g[i][j].second << " ";
}
// cout << endl;
}
dijkstra(1, x);
system("pause");
return 0;
}
The error I am receiving is:
Error: Expression must have a class type.