I've been searching through the forum but unfortunately I'm not able to find a topic that could provide me with some insight regarding aligning user input. I'm currently building a calculator and using cin to get the user input. But I don't know how to align what the user types into the console. Just like a Windows calculator, basically I want the numbers to start from the right to the left.
For example:
|The one is the first number to be typed and is displaced to the
|left as the second number is typed.
<--------
123456789
But so far, the numbers start from the left to the right:
-------->
123456789
Displaying is:
cout << setw(9) << 123456789 << endl;
Remember to add:
#include <iomanip>
Whether there is a way for input I'm unsure, a workaround would be getchar and appending the number onto the end, clrscr() and display the entire input in this format.