Is anyone able to code this?

ive done a sample already look at it:

1 1 2 0 3 -1 4 -2 5....

such that the 3 terms are 1, 1 and 2 and each term thereafter is defined recusively as the sum of the first 2 items minus the third, that is:

seq(n) = seq(n-3)+seq(n-2)-seq(n-1)

the programme accepts the number into the vairable n

implement the recursive function that computes the above series, call the function recursiveSeq().

The main() program should look like this:

cout<< "Enter n = ";

cin>>n;

cout<<"Recursive computation: " <<recursiveSeq(n)<<endl;

But it only works for up to some certain of numbers??i dont know why??and how do i do it if i want to input negative numbers??Code:`#include <iostream>`

: using namespace std;

:

:

:

: int recursiveSeq(const int n)

: {

: if (1==n || 2==n)

: {

: return 1;

: }

: else if (3==n)

: {

: return 2;

: }

: else

: {

: return recursiveSeq(n-3) + recursiveSeq(n-2) - recursiveSeq(n-1);

: }

: }

:

: using std::cout;

: using std::cin;

: int main()

: {

: int n;

:

: cout<< "Enter n = ";

: cin>>n;

cout<<"Recursive computation: " <<recursiveSeq(n)<<endl;

}