Use code tags. Without them, all your indentation goes away, which makes your code very hard to read.
If your book really contained the line
delete [] x,a,b,c,beta,gamma,r;
then I suggest you stop using that book, because the author doesn't know C++ very well. Ditto for the overall design of the program.
That said, the first place I'd look for your error is in the line
x(n-1)=gamma(n-1);
which surely should be
x[n-1]=gamma[n-1];
if that's not the only problem, please repost the code using code tags, and please tell us which line or lines the compiler said was in error.