C++ Vector Elements Count
In C++, using the vector header, how do I find the number of elements? #include <iostream> #include <cmath> #include <fstream> #include <cstdlib> #include <vector> using namespace std; int primer(int max); int main() { system("pause"); return 0; primer(1000); } int primer(int max){ vector<int> a; a[1]=2; for (int i=2;i<=max;i++){ bool prime=true; for (int ii=1;ii<=#a;ii++) { if i/a[ii]==math.floor(i/a[ii]) { prime=false; } } if prime==true { a[#a+1]=i; } } for (i=1;i<=#a;i++) { cout << a[i]); } } } I originally wrote the code for lua, and this is my attempt to translate it to C++. I would