#include
#include
#include
#include
#include // From http://cs.dvc.edu/HowTo_CSleep.html
using namespace std;
class fibonnaci_series{
public:
fibonnaci_series(intx); //Construction
void push(intn); //Adds a new item to stack
unsigned intpop(); //remove the head guy (the most recently added item)
boolisEmpty(); //check if we have any item added.
voidreverse(); //List all items of stack.
private:
unsigned*fib; //A pointer to show the head node
unsigned shortsize; //how many items stack has
}
fibonnaci_series:: fibonnaci_series(int x){
size = 0;
unsigned*fib = new unsigned int(x);
}
// add an item as the head one in the stack
void fibonnaci_series::push(int n)
{
if(n<=1){
fib[ size++ ] = n;
}
for(int i=2;i<=n;i++){
fib[i]= fib[i-1]+fib[i-2];
}
}
unsigned int fibonnaci_series::pop()
{
return fib[–size];
}
void fibonnaci_series::reverse()
{
while (size > 0)
cout <<fib[–size] << “, “;
}
bool fibonnaci_series::isEmpty()
{
return size;
}
int main(int argc, const char * argv[]) {
fibonnaci_series S(30);
const int z[]=30;
cout << “Enter numbers:”;
cin >> z;
for (int j =
PayPal Gateway not configured
PayPal Gateway not configured