I am currently working on a small project with Fibonacci numbers and it requires me to report an error when given a negative numbers. This is the assignment my professor gave me,
"The program is not assured of receiving good data, thus if -2 is received as the number of numbers, an error should be reported."
I am having a bit of trouble setting up the error report.
# include <iostream.h>
void main ()
{
int x=0, y=1, b, n=0,ter;
cout<<"Enter The number of terms";
cin>>ter;
cout<<x<<" "<<y<<" ";
while (n<ter-1)
{
b=x+y;
cout<<b<<" ";
x=y;
y=b;
n++;
}
}