1 #include"stdio.h" 2 #include"windows.h" 3 /* 4 void gotoxy(short x,short y) 5 以命令窗口左上角顶点为原点,向右为X轴正方向,向下为Y轴正方向的坐标系上 6 将光标跳到指定坐标 7 */ 8 void gotoxy(short x,short y) 9 { 10 COORD coord; 11 coord.X=x; 12 coord.Y=y; 13 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord); 14 } 15 void main() 16 { 17 int randx,randy,randN; 18 srand((unsigned)time(0)); 19 gotoxy(0,10); 20 printf("<---The point (0,10)\n"); 21 system("pause"); 22 while(getchar()=='\n') 23 { 24 randx=rand()%20; 25 randy=rand()%20; 26 randN=rand()%10; 27 gotoxy(randx,randy); 28 printf("%d",randN); 29 } 30 }