Hello all. I am working on this program and having some troubles with it. I have tried lots of different things and can't get it to do what I want. I guess I am not really understanding the code and how to word it properly. I am writing a program that will show the Fibonacci sequence numbers, ask the user to input the amount of numbers they want shone, and print five numbers per line. I want to use a for loop, not show zero, and i'm thinking I should use nested loops to show invalid input for zero. This is what I have so far. Thank you for any help given.
#include <iostream>
#include <iomanip>
using namespace std;
void main()
{
int fib1 = 0;
int fib2 = 1;
int fib3;
int numbers;
int counter = 0;
cout << "Please enter the number of Fibonaccis to calculate ==> " ;
cin >> numbers;
for (numbers >= 1; counter <= numbers; counter++)
{
counter++;
fib3 = fib1 + fib2;
cout << fib3 << setw(16);
fib1 = fib2;
fib2 = fib3;
}
/* if (numbers <= 0)
cout << "Invalid Input\n";
do
{
counter++;
fib3 = fib1 + fib2;
cout << setw(16) << fib3;
fib1 = fib2;
fib2 = fib3;
}
while (counter <= numbers);
*/
cout << endl;
}