1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <iostream>
#include <windows.h>
using namespace std;
void gotoxy (int x, int y);
int main()
{
int Xarray[10] ={2,8,14,20,26,32,32,44,50,56};
int Yarray[10] ={8,11,14,17,20,23,26,29,32,35};
while(true){
int i= rand() % 10;
int j= rand() % 10;
int rand1 = Xarray[i];
int rand2 = Yarray[j];
for(i=rand1;;){
for(j=rand2;;){
gotoxy(i,j);
cout << "+";
Sleep(2000);
gotoxy(i,j);
cout << " ";
}
}
}cin.get();
Sleep(25);
system("pause");
return 0;
}
void gotoxy (int x, int y)
{
COORD coord; // coordinates
coord.X = x; coord.Y = y; // X and Y coordinates
SetConsoleCursorPosition(
GetStdHandle(STD_OUTPUT_HANDLE), coord); // moves to the coordinates
}
|