I'm exploring C++ and trying to make a simple loop that will clear screen. I know in C, the 'system' command syntax:
system("cls");
will make the command terminal clear the screen. Here is the code:
#include <iostream>
using namespace std;
int main()
{
char choice = 'a';
while(choice != 'x')
{
cout << "What is the variable?" << endl;
cin >> choice;
system("cls");
}
cout << choice << " is the variable" << endl;
return 0;
}
This is my error message:
error: 'system' was not declared in this scope
Do I need to include a library to use system in C++? I cannot find 'system' in the index of my books, so this may not be C++'s appropriate syntax to accomplish this.