- #1
deltapapazulu
- 84
- 12
I am relatively new to programming and C++ and for the life of me I can't figure out why entering a '0' as input in the do-while loop here terminates the loop.
Code:
// vector::push_back
#include <iostream>
#include <vector>
int main ()
{
std::vector<int> myvector;
int myint;
std::cout << "Please enter some integers (enter 0 to end):\n";
do {
std::cin >> myint;
myvector.push_back (myint);
} while (myint);
std::cout << "myvector stores " << int(myvector.size()) << " numbers.\n";
return 0;
}