   Time and Clear Screen
  Hello, this is my first post in the forums. I've been doing some basic C++ programming and was wondering if anyone could answer some questions.Does anyone know of any c++ commands to clear the screen in a basic text application?I'm also trying to find information on the the uses of time and delays within text applications, such as making the screen wait several seconds before displaying a readout or cout line, etc.Any links or advice would be much appreciated.If these questions arent clear enough to illicit a response, please contact me and I'll try to clarify.   
  for clearing the screen you can use this commandsystem("cls");its dos command but it works just fine =)(dont forget to include stdlib.h   ;  Here's an example from a pretty good c++ reference page on how to wait and countdown for a few seconds using clock in time.h;Quote:Original post by Fifty-FiveHello, this is my first post in the forums. I've been doing some basic C++ programming and was wondering if anyone could answer some questions.Does anyone know of any c++ commands to clear the screen in a basic text application?I'm also trying to find information on the the uses of time and delays within text applications, such as making the screen wait several seconds before displaying a readout or cout line, etc.Any links or advice would be much appreciated.If these questions arent clear enough to illicit a response, please contact me and I'll try to clarify.If I'm correct, clearing the screen is system-specifc.  If you're on windows you can try "System("cls")", but I forgot if it's 's' or 'S'...  Just try both.  I think its in cstdlib.You can use the function time() from ctime to get the amount of seconds since 1970..  Then to time that each cout, for example, is displayed at an interval of 500 milliseconds, for example, you do this:unsigned milli = time(NULL) * 1000;cout << "Hi!" << endl;while ((time(NULL) * 1000) - milli < 500)    /*wait*/;cout << "Hi!  .5 seconds after!" << endl;Good luck!   ;  If your using a Win32 Console it is better to use the console functions rather than system("cls"). And Sleep(1000) is rather simple, you have to include windows.h#include <windows.h>void clrscr(){    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);    COORD coordScreen = { 0, 0 };   DWORD cCharsWritten;    CONSOLE_SCREEN_BUFFER_INFO csbi;    DWORD dwConSize;    GetConsoleScreenBufferInfo( hConsole, &csbi );  dwConSize = csbi.dwSize.X * csbi.dwSize.Y;    FillConsoleOutputCharacter( hConsole, (TCHAR) ' ',dwConSize, coordScreen, &cCharsWritten );  GetConsoleScreenBufferInfo( hConsole, &csbi );  FillConsoleOutputAttribute( hConsole, csbi.wAttributes,dwConSize, coordScreen, &cCharsWritten ); SetConsoleCursorPosition( hConsole, coordScreen );   }#include <iostream>int main(){    std::cout << "hello world";    Sleep(5000);    clrscr();    std::cout << "I said, hello world!\n";    } [Edited by - simon10k on April 20, 2006 2:33:31 PM];  Thanks for the help, thats exactly what I was looking for.   