I'm stuck with forrange loop in VS Code. It gives me error:
expected a ';'
expected an expression
mp[0] = 10;
mp[1] = 200;
mp[2] = 3000;
mp[3] = 40000;
for (int id : mp) // error for ":" and ")"
{
std::cout << id << std::endl;
}
Thank you for answer, Cory but problem still there:
explicit type is missing ('int' assumed) [13,21]
reference variable "item" requires an initializer [13,27]
expected an expression [13,31]
{
std::map<int, int> mp;
mp[0] = 10;
mp[1] = 200;
mp[2] = 3000;
mp[3] = 40000;
for (auto const &item : mp) // error for "&" and ":" and ")"
{
std::cout << item.first << ' ' << item.second << std::endl;
}
}