Array subscript problems

Hi! I'm a beginner in C++ , I'm learning about it now in high school and while I was writting down a code an error appeared.It says :"invalid types 'int[int]' for array subscript".I don't know what to do and if anyone helps me I would be thankful.
[code]
include<<iostream>>
using namespace std;
int main()
{
int n=5,z,i;
int a[5]={2,4,5,6,8};
cout<<"vektori z[n] eshte"<<endl;
cin>>n;
for(i=1;i<=n;i++)
{
z[i]=i+ a[i];
cout<<"z["<<i<<"]"<<z[i]<<endl;
}
return 0;
}
z is a single integer, not an array.

Also, your loop condition is i <= n. This is wrong. See if you can figure out why.
thank you !
Topic archived. No new replies allowed.