/************* 1. Converting a decimal integer into binary can be implemented by a stack data structure. The arithm etic involved is as follows: \includegraphics{dectobin.jpg} You could use the \% (mod) arithmetic operator to find the remainders, push the remainders onto a st ack and then pop the stack repeatedly to get the binary representation of the given decimal integer. Write a C++ program that accepts an integer as input and prints out its binary representation. **********/ #include using namespace std; const int MAX_CAPACITY=128; class myStack{ public: int i[MAX_CAPACITY]; //stack of integers int top; myStack(){top=-1;} //default value of top bool isempty(){ return(top==-1); } bool push(int x){ if (top < MAX_CAPACITY-1){ ++top; i[top]=x; return true; } else { return false; } } int pop(){ int cur=top; top--; return i[cur]; } }; int main(){ int x; cout<<"Enter integer to convert to binary"<>x; myStack st; while(x > 1){ st.push(x%2); x=x/2; } //We got up to the last stage of division - quotient is now 0 or 1 - that needs to go on the stack st.push(x); while(!st.isempty()){ cout<