k obviously i am a noob, but i have observed the basic courtasies for posting. i searched for it in posts and did not find an answer, anyways...
im trying to write a code to output (part of) the fib sequence, but i keep running into the same problem.
Code:
#include <iostream.h>
int fib1[50];
int a=0;
int b=1;
int c=2;
int main()
{
fib1[a]=1; //sets fib1[whatever # a is] to start out at 1
fib1[b]=1;
fib1[c]=2;
for(int x=0;x<50;x++) //set for 50 repetitions
{
fib1[a]+fib1[b]=fib1[c]; //value in fib1[a]+value in fib1[b]=value in fib1[b]. but for somereason my compiler is saying its not an lvalue
a++; //increments a
b++;
c++;
cout<<fib1[a]<<", "; //outputs #s
}
return 0;
}
i have tried putting the values from the array into int variables, but i had the same problem. same thing happended when i used pointers.