Hi there, I am currently taking an intro to c++ class and need help with a homework assignment I have:
--------------------------------------------------------------------------------------
Write a C++ program that performs the following tasks:
Prompt the user to specify how many Fibonacci numbers to calculate.
Calculate the specified Fibonacci sequence using only
int
data types.
Output an error if your Fibonacci computation exceeds the highest
possible value for an
int
data type. In other words, abort the program
if a ”rollover” occurs.
Output the final Fibonacci value.
Also, your starting values for prev and prev2 are incorrect. The first terms of the Fibanacci sequence are 0,1,1 and you are not going to get those with your program.
Nothing should go after else, it should just be else on its own.
You are outputting fibnum, but you want to output current.