Solving problems using stacks
Now that we know how to use the Stack
 class, let's use it to solve some computer science problems. In this section, we will cover the decimal to binary problem, and we will also transform the algorithm into a base converter algorithm.
Converting decimal numbers to binary
We are already familiar with the decimal base. However, binary representation is particularly important in computer science, as everything in a computer is represented by binary digits (0 and 1).
This is extremely helpful when working with data storage for example. Computers store all information as binary digits. When we save a file, the decimal representation of each character or pixel is converted to binary before being stored on the hard drive or other storage media. Some file formats, like image files (.bmp, .png) and audio files (.wav), store data partially or entirely in binary format. Understanding binary conversion is crucial for working with these files at a...