Ok, I have to create a program that prints whether a number is in the Fibonacci sequence. This is what i have so far, but i could use some help:
I don't know if this is the best way to go about this problem. Also, is there a way for me to use "bool found=false;" or "char found='N';"Code:#include <iostream> #include <iomanip> using namespace std; int main (void) { int valin, n=0; cout << "Input a positive integer: " << endl; cin>> valin; if (valin==0 || valin==1) cout << "The number" << valin << "is in the Fibonacci sequence." << endl; else if (valin==(n-1)+(n-2)) cout << "The number" << valin << "is in the Fibonacci sequence." << endl; else cout << "The number" << valin << "in not in the Fibonacci sequence." << endl; return 0; }
any help would be appreciated, thanks