Print Statement

//this works
for(vector::iterator it = v[i].begin();it!=v[i].end();it++)
cout<<(*it).name<<" "<<(*it).marks<<endl;

//but this doesn’t
for(auto it:v[i])
cout<<(*it).name<<" "<<(*it).marks<<endl;

Why?

can you share the complete code ?
so that i can check it

How to Share Link of Code??

  1. paste your code at https://ide.codingblocks.com/

  2. click->file->save

  3. after a link will be generated at top in place of url something like: https://ide.codingblocks.com/s/12345

  4. share this link

I got it, thank you!