Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to run #include <stdblib.h> like run system("cls")

+5 votes
asked Jan 30 by Reynaldi Bagas Pratama (170 points)

1 Answer

0 votes
answered Feb 2 by Peter Minarik (69,270 points)

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).

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...