I am attempting to generate an array of arrays. The code compiles but hangs when I run it (suggesting an infinite loop perhaps?). I am unsure how code would be necessary for a wise and kind :) person to help me, but I have included what I deemed necessary.
Thank you
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <vector>
- #include <cmath>
- #include <stdio.h>
- #include <cstdlib>
- #include <ctype.h>
- using namespace std;
- int main (){
These sections work correctly.
nsteps and narray are previously entered constants.
Here is where I am trying to generate the array of arrays.
Expand|Select|Wrap|Line Numbers
- vector<double> tsab_array;
- for(int j=0; j<narray;j++)
- {
- for(int i=1; i=nsteps; i++)
- {
- double tsab = (1-1/i)*sab_array[j] - i*(tab_array[j]);
- tsab_array.push_back(tsab);
- }
- }
- for(vector<double>::iterator v=tsab_array.begin(); v != tsab_array.end(); v++)
- {
- cout<<*v<<"\n";
- }
- return 0;
- }