[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.
Technical Discussion :: C++

10 / 187

How is an iteration over a map is carried out?

Answer:

Iteration over a map is simply iteration over a sequence of pair < const key, mapped_type >. For e.g. We might print out the entries of a phone book like this
Void f(map& phone_book) {
Typedef map(string, number)::const_iteration CI;
For(CI =phone_book.begin( ); p!=phone_book.end( );++p)
cout<first<<’\t’<second<<’\n’;
}
A map iterator presents the elements in ascending order of its keys.

Asked In ::

Post Your Answer Here:


Rate This: +0 -0     
Report    

Post Your Reply Here:

Alert me
q4i-reply-your-answer

Report Error

Please Login First Click Here

Most Popular Qs.