The system ("cls") does not work.

Asked 1 years ago, Updated 1 years ago, 361 views

...

for(int i = 0; i <= 3 ; i++){
    system("cls");
    turn(&A,&B,&C);
    printf("<PlayerStat>\n");
    printf("A : %d\nB : %d\nC : %d\n",A,B,C);
    sleep(3);
}

I did it like this

I can't erase the cmd window Why is that.

system

2023-04-30 15:38

1 Answers

cls is a command that is only available at the command prompt in Windows.

Looking at the code sleep(3), it looks like a Unix-compatible environment. In Unix-compatible environments, you must use the clear command instead of cls. Note that in Windows, the first letter of the slip function is uppercase, and in Unix environments, the first letter of the slip function is lowercase.

If your environment is not Windows, replace system("cls") with system("clear") and run it.


2023-04-30 23:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.