vector types in c++


#include <vector> using namespace std; void PrintVector(vector<int> &v) { for ( int i=0;i<v.size();i++){ cout<<v[i]<<" "; } } vector<int> MakeRandomVector(int sz) { vector<int> numbers; numbers.reserve(10); for (int i=0;i<sz;i++){ numbers.insert(numbers.end(),1,rand()%(i+1)); } return numbers; }

For the sake of documenting an example of using a vector and displaying the results so that the operation as extended is visible and experimentation can be observed to determine if assumptions of the action of the process is consistent with actual results. I was not aware that FPE ( floating point error ) actually was reported as a signal. I seem to remember testing that with my signal handler and getting no signal. I will have to investigate that again and see if the test itself was at fault. In any case, rand()%(int zero) creates:


Floating point exception

0 comments:

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen