I need some help finishing my Reverse Polish Calculator. We have to have two classes, one for the stack of doubles that you will use for performing the operations and keeping track of the results... the other for the calculator that prompts for input, works with the stack and outputs the answers. Menu Functions... n (push number), + (add), - (subtract), * (multiply), / (divide), s (square root), p (print stack), x (exit).

This is the code I have so far:

#include <iostream>
#include <math.h>

//Creation of Class Stack
class Stack{
public:
void push(double x);
bool empty();
double pop();
double peek();
Stack();

private:
double array[1000];
int top;
};

//Sets the top of the Stack to zero
Stack::Stack(){
top=0;
}

//Creation of Class Calculator
class Calculator{
public:
void Add(Stack X);
/*void Sub();
void Multi();
void Divide();
void SQRoot();
void PrintStack();*/
};

//Pushes the Stack
void Stack:ush(double x){
cin>>top;
top++;
}

//Pops the Stack
double Stack:op(){
top--;
return array[top];
}

//Peeks (or looks) at the Stack's Top Value
double Stack:eek(){
return array[top-1];
}

//Bool function to check for empty Stack
bool Stack::empty(){
if ((top-1)==-1){
return true;}
else{
return false;}
}

//Add Function
void Calculator::Add(Stack X){
X.push(X.pop()+X.pop());
}


//Start Main Function
void main(){
Stack X;
Calculator Y;
char input='a';
cout<<"n: push number"<<endl;
cout<<"+: add"<<endl;
cout<<"-: subtract"<<endl;
cout<<"*: multiply"<<endl;
cout<<"/: divide"<<endl;
cout<<"s: square root"<<endl;
cout<<"p: print stack"<<endl;
cout<<"x: exit"<<endl;
while(input!='x'){
cout<<"Option(n, +, -, *, /, s, p, x): ";
cin>>input;
switch(input){
case 'n': X.push(x);
break;
case '+': Y.Add(Call);
break;
case '-': //Y.Sub(Stack Call);
break;
case '*': //Y.Multi(Stack Call);
break;
case '/': //Y.Divide(Stack Call);
break;
case 's': //Y.SQRoot(Stack Call);
break;
case 'p': //Y.PrintStack(Stack Call);
break;
case 'x':
cout<<"The code had failed. Only a blue screen flashed itself mockingly at the user. Goodbye."
;
break();
default:
cout<<"Error checking... gotta love it."<<endl;}
}}

Thanks for all your help.