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

+7 votes
asked Jan 30, 2023 by Reynaldi Bagas Pratama (190 points)

2 Answers

+1 vote
answered Feb 2, 2023 by Peter Minarik (86,040 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).

0 votes
answered Jun 26, 2023 by Éder S. (320 points)
not use system (" cls" ) , use system (" clear " )

#include <stdlib.h>
commented Aug 21, 2023 by Éder S. (320 points)
exemple an small code working with it Clear. Software make count of phone .

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;


int pay1,minutes;

int main()  {
   
    label1:
    system("clear");
    cout<<"What value you pay ? 39, 59 or 69 ?   ";
    cin >> pay1;
    cout << "What minute you used ?   ";
    cin>> minutes;
    
   
   if (pay1 == 39 ) {  cout << "You Pay 39$ "<< "\n";
   cout << "Your total Bill is " << pay1 + minutes*0.45 << "\n" ; }
    else if ( pay1 == 59) { cout << "You Pay 59$" << "\n";  
    cout << "Your total Bill is " << pay1 + minutes*0.40 << "\n" ; }
    else if ( pay1 == 69) { cout << "You Pay 69" << "\n";  
    cout << "Your total Bill is ilimitate "  << "\n" ; }
    else {cout << "You tape value wrong" << "\n"  ;}
 
goto label1;
    return 0;
}
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.
...