#include <iostream>
#include <stack> //stack header file

using namespace std; 

stack <int> operands;


int main() 
{
	int input(); 
	void evaluate(); 

}



int input(int, char) //user inputs 3 items into a stack
{
	int item1, item2, item3; //push 3 input items onto a stack and ask for the two operators
	char op, op2; 
	cout << "Enter your postfix expression" << endl;
	cout << "(Enter three numbers followed by two operators, one per line)" << endl;  
	cin >> item1; 
	operands.push(item1);
	cin >> item2;
	operands.push(item2);
	cin >> item3; 
	operands.push(item3);
	cin >> op;
	cin >> op2; 
	return op, op2, item1, item2, item3;
	
}

void evaluate(char &op, char &op2, int &item1, int &item2, int &item3) //evaluate function operations included
{
	

	item3 = operands.top();  //ask for the second operator and do the destignated operation
	operands.pop();
	item2 = operands.top(); 
	operands.pop(); 
	if(op =='+') 
		item2 = item3+item2; 
	else if(op=='*')
		item2 = item3*item2; 
	else if(op=='-')
		item2 = item3-item2;
	else if(op=='/')
		item2 = item3/item2; 
	else if(op=='%')
		item2 = item3%item2;
	else 
		cout << "You have entered an incorrect operator" << endl; 
	operands.push(item2); //push the result back to top of stack

	operands.pop();
	operands.pop();

	if(op2 =='+') 
		item1 = item2+item1;
	else if(op2=='*')
		item1 = item2+item1;
	else if(op2=='-')
		item1 = item2-item1;
	else if(op2=='/')
		item1 = item2/item1;
	else if(op2=='%')
		item1=item2%item1; 
	else
		 cout << "You have entered an incorrect operator" << endl; 
	operands.push(item1); //push result back to top of stack
	cout << "The number remaining in the stack after those operations is " << item1 << endl; 
	
}
