//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?
//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??
paste your code at https://ide.codingblocks.com/
click->file->save
after a link will be generated at top in place of url something like: https://ide.codingblocks.com/s/12345
share this link
I got it, thank you!