The proper (and slower ?) way to do this is using ncurses or similar libraries. Here We’ll talk about a “quick and dirty” method using control characters.
There are special characters, referred to as “control characters“, which, when read by the the console, make it change the way it displays text.
The general format of these control characters is: