Can some one tell me how do i display real time in c++. what i mean is that while the program is running you can see the seconds and or minutes counting down like a real clock h
Try this:
while (true) {
std::cout << '\r'; // return to the beginning of the line
getAndPrintTime(); // do what you do now, but don't write endl
}
Assuming that you want to keep overwriting the same place in the terminal, two simple things to use are '\r' for carriage return, and '\b' for backspace (if you want to back up a character rather than a whole line).