📄 hello5.c
字号:
/* hello5.c * purpose bounce a message back and forth across the screen * compile cc hello5.c -lcurses -o hello5 */#include <curses.h>#define LEFTEDGE 10#define RIGHTEDGE 30#define ROW 10main(){ char message[] = "Hello"; char blank[] = " "; int dir = +1; int pos = LEFTEDGE ; initscr(); clear(); while(1){ move(ROW,pos); addstr( message ); /* draw string */ move(LINES-1,COLS-1); /* park the cursor */ refresh(); /* show string */ sleep(1); move(ROW,pos); /* erase string */ addstr( blank ); pos += dir; /* advance position */ if ( pos >= RIGHTEDGE ) /* check for bounce */ dir = -1; if ( pos <= LEFTEDGE ) dir = +1; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -