# 小球 **Repository Path**: wjj912409/pellet ## Basic Information - **Project Name**: 小球 - **Description**: No description available - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-10-24 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #include #include #include int main() { int i, j,a,b; int x = 1; int y = 5; int velocity_x = 1; int velocity_y = 1; int left = 0; int right = 20; int top = 0; int bottom = 10; while (1) { x = x + velocity_x; y = y + velocity_y; system("cls"); for (i = 0; i <= x; i++) { printf("\n"); for (a = 0; a < 20; a++) printf("|"); } for (j = 0; j <= y; j++) { printf(" "); for (b = 0; b < 10; b++) printf("--"); } printf("o\n"); sleep(50) if ((x == top) || (x == bottom)) velocity_x = -velocity_x; if((y==left)||(y==right)) velocity_y=-velocity_y; printf("\a"); } return 0; }