c++ print one line to console instead of multiple

C++
cout << "\r" << string;
Source

Also in C++: