I am getting an error in my compiler:
Warning: implicit declaration of function 'system'
I added:
system("cls");
To be able to clear the screen, and now I get the error. I am using this code to test:
#include <stdio.h>
int nothing; //random name
int main()
{
printf("this is a msg");
scanf("%d",¬hing);
system("cls");
printf("hello");
getchar();
return 0;
}
This is just a test code, so it's very sloppy. I am new to coding so any help would be appreciated.
For C++: #include <cstdlib>, for C: #include <stdlib.h>.
Or, you can do as follows:
#ifdef __cplusplus__
#include <cstdlib>
#else
#include <stdlib.h>
#endif
if (system("CLS")) system("clear");
You can also see a full article w.r.t Clear the screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With