# How can I clear console using C++?

C++Server Side ProgrammingProgramming

We can clear the console using C++ code. To do this we have to execute some system commands. In Linux systems, the POSIX is used. We can call system() function to execute system command. For clearing the console in linux, we can use “clear” command. This will be passed inside the system() function.

Let us see the code to get the better idea.

## Example

#include <iostream>
using namespace std;
int main () {
cout << "Now the screen will be cleared!" << endl;
system("clear");
cout << "Empty Screen" << endl;
return 0;
}

## Output

After

Published on 03-May-2019 07:08:04