Apr 18, 2008 at 12:47am UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <iostream>
#include <math.h>
#include <conio.h>
#include <iomanip>
using namespace std;
double x[50] = {0.0};
int j, M=5, N=1;
double P[350][350] = {0.0};
int main()
{
for (j = -M; j < M; j++)
P[N][j] = j+1;
for (j = -M+1; j < M; j++)
{
x[j] = (1*j)*P[N][j] + (j*(P[N][j+1] + P[N][j-1]));
cout << endl << " x= " << x[j] << endl;
}
getch();
return 0;
}
[/code]
It will run when I change the for loop to a postive number, but it will not work with " j = -M+1). thanks
Last edited on Apr 18, 2008 at 1:23am UTC
Apr 18, 2008 at 7:21am UTC
Could you let us know what you are wanting it to do?
The code (as above) actualy compiles and runs (using VS 2005), so it's difficult to suggest changes without knowing your aim:-)
Apr 18, 2008 at 7:38am UTC
@pyramidork
what kind of compiler do u use?
as @Faldrax said, it runs with VS 2005
Apr 18, 2008 at 2:54pm UTC
Thanks for replies. Using bloodshed dev++. The output screen freezes and will not execute the "x[j] =" statement.