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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#include <iostream>
#include <string>
using namespace std;
#include <windows.h>
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
COORD CursorPos;
void gotoxy_s(int x,int y,string text)
{
CursorPos.X=x;CursorPos.Y=y;
SetConsoleCursorPosition(hOut,CursorPos);
cout<<text;
}
int main()
{
int len,y;
string holder=" ";
string X[]=
{" "
,"X X"
," X X "
," X "
," X X "
,"X X"
," "
," "
," "
};
string Zero[]=
{" "
," 000 "
,"0 0"
,"0 0"
,"0 0"
," 000 "
," "
," "
," "
};
len=9; //this was the problem change it to 8
do{
for (y=0;y<len;y++)
{
gotoxy_s(3,2+y,X[y]);
}
for (y=0;y<len;y++)
{
gotoxy_s(11,2+y,Zero[y]);
}
holder = X[len];
for (y=len;y>0;y--)
{
X[y]=X[y-1];
}
X[0]=holder;
holder =Zero[0];
for (y=0;y<len;y++)
{
Zero[y]=Zero[y+1];
}
Zero[len]=holder;
Sleep(80);
}while(true);
return 0;
}
|