It can be done if the carriage return character behaves as specified.
But I'm unwilling to do the OP's homework for him.
If CR behaves as sortof-almost-specified, AND 'overwriting' a line
works as you apparently expect but which is not even suggested by the
Standard. On some, formerly common, devices it can't. On modern
bitmapped displays it would be reasonable to ior the bitmaps to
simulate traditional over_printing_. It would be legal to xor the
bitmaps, and I think I might even come up with a plausible rationale
to do so. It would even be legal to combine the two character _codes_
and use the result as a single new extended code, probably
Unicode/10646 assuming the narrow codes are ASCII or ASCII-like.
And if one doesn't want 'continous' aka 'gradual' scrolling, nor
scrolling at a rate (or rates) more precise than the
implementation-dependent approximation of time() et al.
And if the output (device) supports sufficiently long lines, here 50
characters, which similarly is only sortof-almost-specified.
- formerly david.thompson1 || achar(64) || worldnet.att.net