need help with classes, stacks
program isn't working....I have been working on it and reading. Am I even close?
The program has two classes, one for the data, one for the stack. The program is supposed to get a number from the user and convert the number to binary, octal and hex. With binary push each remainder on the stack and then pop them off traversed. I am just trying to get it to work with binary right now
syntax error : missing ';' before 'namespace'
syntax error : missing ';' before 'namespace'
stack::pop' : looks like a function definition, but there is no formal parameter list; skipping apparent body
'{' : missing function header (old-style formal list?)
'bool stack::push(int)' : overloaded member function not found in 'stack'
Code:
//number.h
#pragma once
class number
{
public:
int remainder;
number* data;
number* next;
number(void);
~number(void);
};
class stack
{
private:
int count;
stack* top;
public:
stack() {count = 0; next = NULL;}
~stack();
int is_empty();
void getnum(int);
bool pop();
bool push();
}
//number.cpp
#include "number.h"
#include <iostream>
using namespace::std;
number::number()
{
remainder = 0;
next = NULL;
}
number::~number()
{
}
stack::stack()
{
count = 0;
top = NULL;
}
stack::~stack()
{
}
bool stack::pop{}
{
number* dltptr;
bool success;
if (count == 0)
{
success = false;
}
else
{
dltptr = top;
dataout = top->
}
}
bool stack::push(int rem)
{
bool success;
int n;
number* nptr;
if (n == 0)
{
success = false;
}
else
{
nptr = 0;
nptr->remainder = top;
top = nptr;
count++;
success = true;
}
return success;
}
program.cpp
#include "number.h" //class
#include <iostream> //headers
using namespace::std;
void binary(int);
stack intstack;
int main()
{
int numb;
binary (numb);
}
void binary (int numb)
{
int n;
int nu;
n = nu % 2;
//push n on stack
if (nu == 0)
{
return ;
}
else
{
return binary(nu / 2);
}
}