I'm having extreme difficulty troubleshooting this, I'd be grateful for any advice. 1. I am trying to create a mesh array. This should generate a vector of 50, 52, 54 56...100. In debugging I never see the vector increase beyond 50. 2. I am trying to print the mesh array. I cannot use ostream here because this is not a class. So even if I could get the vector working, I don't know how to print it.
#include <vector>
#include <iostream>
using namespace std;
vector<double> MeshArray(double start, double end, double h)
{
vector<double> mesh;
mesh.reserve(100);
for (double i = start; i <= end; i + h)
mesh.push_back(i);
return mesh;
}
int main()
{
vector<double> MA = MeshArray(50,100,2);
cout << MA;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire