c语言 - 如何实现"加载屏幕"?



有没有办法调用loading_screen()然后在三秒钟后清除屏幕,然后进入程序?

#include <stdio.h>

void loading_screen() {
printf("n*t *t *t *t *t *t *t *n* Welcome to your blah blah! *n*t *t *t *t *t *t *t *nn");
}

void starting_screen() {
printf("1. add new recipen");
printf("2. search for recipen");
printf("3. delete recipen");
}

int main(int argc, char *argv[]) {
loading_screen();
starting_screen();
return 0;
}

您可以在 Windows 上使用system("cls");或在 Linux 上使用system("clear");

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void loading_screen() {
printf("n*t *t *t *t *t *t *t *n* Welcome to your blah blah! *n*t *t *t *t *t *t *t *nn");
}

void starting_screen() {
printf("1. add new recipen");
printf("2. search for recipen");
printf("3. delete recipen");
}

int main(int argc, char *argv[]) {
loading_screen();
sleep(3);
system("cls");//system("clear");
starting_screen();
return 0;
}

最新更新