Q:

Can't find why error comes

Possible Duplicate:
c++ compiling “error: expected constructor, destructor, or type conversion before ‘=’ token ” 

Here's my C++ program. When I compile it, an error comes:
Line 6: Expected constructor, destructor or type conversion before '=' token.

Now I can't see what's wrong in it code-wise (i.e. logically it may be) and I can't debug this error. Can somebody please tell me a remedy to this error?
#include<iostream>
using namespace std;

int go[10000],f[10000],n,i;
f[0]=1;
f[1]=1;
go[0]=1;
go[1]=1;

int g(int x) {
    return (f[x-1] + go[x-1]);
}

int main() {
    cin>>n;

    for (i=2;i<=n;i++) {
        f[i]=f[i-1]+f[i-2]+(2*g(i-2));
    }
    cout<<f[i];
    system("PAUSE");
}

A:

In C++, you cannot assign values to a global array outside a function. Move the following lines inside the main function:
f[0]=1;
f[1]=1;
go[0]=1;
go[1]=1;

A:

You should only assign values to variables inside function declarations.
#include<iostream>
using namespace std;
int go[10000],f[10000],n,i;
int g(int x) {
    return (f[x-1] + go[x-1]);
}
int main() {

f[0]=1;
f[1]=1;
go[0]=1;
go[1]=1;

    cin>>n;

     for (i=2;i<=n;i++) {
        f[i]=f[i-1]+f[i-2]+(2*g(i-2));
    }
    cout<<f[i];
    system("PAUSE");
}

A:

You can't do assignments at file scope.
You can do initialisation, however.
Like this:
int go[10000] = {1, 1};  // The remaining 9998 elements will be set to zero automatically.
int f[10000] = {1, 1};

Or move the assignments inside main.

