Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

C++ for loop using for auto

//I think this is a better way for a for loop
//for like going through arrays or something
//hope you like it :)
//be sure to do #include <set>
int main()
{
  set<char> letters = {'A', 'B', 'C'};
  for (auto itr = letters.begin(); itr != letters.end(); ++itr){
    cout << *itr << endl;
  }
}
 
PREVIOUS NEXT
Tagged: #loop #auto
ADD COMMENT
Topic
Name
3+4 =