#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
int main()
{
char tile[10] = {'_'};
int a, b = 0;
srand(time(NULL));
b = 4;
while (1)
{
a = rand() % 2;
if (a == 0)
{
b -= 1;
if (b < 0)
{
break;
}
}
else
{
b += 1;
if (b > 9)
{
printf("_ _ _ _ _ _ _ _ _ _ \n");
break;
}
}
for (int i = 0; i < 10; i++)
{
tile[i] = '_';
}
tile[b] = '*';
for (int j = 0; j < 10; j++)
{
printf("%c ", tile[j]);
}
printf("\n");
_getch();
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: