Advertisement
metalx1000

Cross Platform - Clear and Sleep

Nov 28th, 2012
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include
  2.  
  3. #ifdef __unix__
  4. # include
  5. #define clear() system("clear");
  6.  
  7. #elif defined _WIN32
  8. # include
  9. #define sleep(x) Sleep(1000 * x)
  10. #define clear() system("cls");
  11.  
  12.  
  13. #endif
  14.  
  15. int main(){
  16.  
  17.     char name[20];
  18.  
  19.     clear();
  20.     printf("Hello World\n");
  21.     sleep(2);
  22.  
  23.     clear();
  24.     printf("Please Enter You Name: ");
  25.     fgets(name,sizeof(name),stdin);
  26.     sleep(2);
  27.  
  28.     clear();
  29.     printf("Hello %s", name);
  30.     sleep(2);
  31.    
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement