~cpp #include <stdio.h> #include <stdlib.h> #include <Windows.h> void main() { int number = 0; while(1) { system("CLS"); printf("%d", number); ++number; Sleep(1000); } }
~cpp #include <stdio.h> #include <stdlib.h> #define SCREEN_WIDTH 17 #define SCREEN_HEIGHT 9 #define ID_BLOCK 1 void main() { int screenArray[SCREEN_HEIGHT][SCREEN_WIDTH] = {0,}; int x, y; while(1) { for(int i = 0; i < SCREEN_HEIGHT; ++i) { for (int j = 0; j < SCREEN_WIDTH; ++j) { if (ID_BLOCK == screenArray[i][j]) printf("■"); else printf(" "); } printf("\n"); } scanf("%d %d", &x, &y); system("CLS"); screenArray[y][x] = ID_BLOCK; } }