有没有办法调用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 *\n\n");
}
void starting_screen() {
printf("1. add new recipe\n");
printf("2. search for recipe\n");
printf("3. delete recipe\n");
}
int main(int argc, char *argv[]) {
loading_screen();
starting_screen();
return 0;
}
答案 0 :(得分:2)
您可以在 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 *\n\n");
}
void starting_screen() {
printf("1. add new recipe\n");
printf("2. search for recipe\n");
printf("3. delete recipe\n");
}
int main(int argc, char *argv[]) {
loading_screen();
sleep(3);
system("cls");//system("clear");
starting_screen();
return 0;
}