0

Can anybody help me with a code to clear the screen using C++.
I have a program that has to continuously make changes to an array and display the array after each modification.
All I need is a code to clear the screen after each display.
Thank you

7
Contributors
6
Replies
7
Views
12 Years
Discussion Span
Last Post by alc6379
0

Depending on your operating system, use a DOS or Unix call ...

// clear the screen in console mode, the dirty way ...

#include <cstdlib> 

int main(void)
{

  // your code

  system ("cls");
  //system ("clear"); // for Unix
  return(0);
}

Be careful with these old DOS commands, it's easy to whipe out your whole hard-drive!

0

Does the system ("cls") method work in windows 2k, because in my memory, "cls" is a DOS command and win 2k is not built on DOS.

0

Does the system ("cls") method work in windows 2k, because in my memory, "cls" is a DOS command and win 2k is not built on DOS.

It does work. The "Command Prompt", as it is called, supports a range of DOS commands. cls, for instance, is one of them.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.