I got two lists or vectors (I think the solution is available to both types)
In one list/vector i got e.g. 5 and the other list e.g. 6
now I want to iterate through both list and print them out accordingly to my illustration
List 1 List2
Value 1 Value 1
Value 2 Value 2
Value 3 Value 3
Value 4 Value 4
Value 5 Value 5
Value 6
My own idea was too use a for-loop with multiple variable in it, but as I understand it doesn't exist in c++ and I haven't figured it out, how to iterate through two lists/vectors that haven't the same size() or length in values in list/vector and get the output like above.
I really hope somebody in this forum can point me to a direction that will learn and educate me.
#include <vector>
#include <iostream>
int main()
{
typedef std::vector<int> Ints;
Ints array;
for(int i = 0; i < 10; ++i)
{
array.push_back(i);
}
//now array has ten elements from 0 to 9
Ints::iterator it = array.begin();
Ints::iterator end = array.end();
for(; it != end; ++it)
{
std::cout << *it << '\n';
}
return 0;
}