Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6902043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:44:57+00:00 2026-05-27T07:44:57+00:00

for (vector<Student_info>::const_iterator iter = students.begin(); iter != students.end(); ++iter) cout << (*iter).name << endl;

  • 0
for (vector<Student_info>::const_iterator iter = students.begin();
     iter != students.end(); ++iter)
    cout << (*iter).name << endl;

In Accelerated C++, code above was told to output all of the data contain in the vector, but if the loop stop when iter != students.end() equal to students.end(), then how does it will proceed to the last element of the vector?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:44:57+00:00Added an answer on May 27, 2026 at 7:44 am

    If I understood well what you asked,it is so because the last element of a vector is actually on the position v.end()-1. So to an element before the v.end() should the loop stop to access all the elements. Is that you asked?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

std::vector< std::vector<coords> >::iterator iter; for(iter = characters.begin(); iter != characters.end(); iter++) { std::vector<coords>* cha
vector<int> nums; nums.push_back(0); nums.push_back(1); nums.push_back(2); nums.push_back(3); vector<int>::iterator it = nums.begin(); it++; cout << it
vector<Widget> vw; // populate vw sort(vw.begin(), vw.end()); Widget w; vector<Widget>::iterator i = lower_bound(vw.begin(), vw.end(),
vector<CGPoint>::iterator i; vector<CGPoint>* bp = bicyclePad.bikePathPoints; for(i = bp->begin(); i != bp->end()-3; i++){ angle
std::vector<std::wstring> lines; typedef std::vector<std::wstring>::iterator iterator_t; iterator_t eventLine = std::find_if(lines.begin(), lines.end(), !is_str_empty()); how do I
std::vector<string> names; std::vector<string>::iterator start = names.begin(); std::vector<string>::iterator end = names.end(); sort (start,end); //are my
suppose we have a vector<student> allstudent Now I would like to sort the students
How do I sort the below code by name, age and score... all three
vector< vector<int> >::iterator temp = mincost.end(); vector<int> a = *temp; if ( *temp !=
I have a vector of Student which has a field name. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.