CLS is a Windows command. OnlineGDB runs on Unix based operating system. Use
system("clear");
instead.
Note: The compiler may reorganize your code for optimization reasons, so don't be surprised if simple programs like
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Type some text then hit ENTER! : ");
// scanf("%*s");
// system("clear");
printf("Hello World");
return 0;
}
do not work as you would have expected. But if you uncomment those two lines, the screen will be cleared (as the printf calls cannot be optimized together anymore).