Solved

Rewrite the Code Below Using the Ranged for Loop and the Auto

Question 42

Essay

Rewrite the code below using the ranged for loop and the auto keyword.
map<int,string> personIDs = {
\quad {1,"Walt"},
\quad {2,"Kenrick"}
};
map<int,string>::const_iterator iter;
for (iter = personIDs.begin();iter != personIDs.end();
iter++)
{
\quad cout << iter->first << " " << iter->second << endl;
}

Correct Answer:

verifed

Verified

The auto keyword makes it easi...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents