#include<stdlib.h>
#include<time.h>
#include<conio.h>
#include<stdio.h>
#include<bios.h>

int main(void)
{
 clrscr();
 struct text_info ti;
 gettextinfo(&ti);
 gotoxy(1, ti.screenheight/3);
 char ch;


 do
 {

         cprintf("Get an answer from a random number generator.  Think\r\n");
         cprintf("of a question that you want answered first, and then press\r\n");
         cprintf("any key but q.  For successive answers, press any key but q\r\n");
         cprintf("again.  When you want to quit, press q.\r\n");
         cprintf("\r\nTo start, press any key but q.\r\n");
         ch = bioskey(0);
         randomize();
 }while(ch == 1);

 char gr[8];
 int hc,wc,index,line,ran,ranx,n;
 hc = ti.screenheight/2;
 wc = ti.screenwidth/2;


         ranx = rand () % 9;
         ran = ranx;

 while(ch != 'q')
 {


 gr[0] = 'N';
 gr[8] = 'Y';

 for(index = 1; index < 8; index++)
         gr[index] = 254;

 clrscr();


 gotoxy(wc-4, hc);

 for(index = 0; index < ranx; index++)
         {
         textcolor(4);
         cprintf("%c", gr[index]);
         }

 for(index = ran; index == ran; ran++)
         {
         textcolor(15);
         cprintf("%c", gr[ranx]);
         }

 for(index = ranx+1; index < 9; index++)
         {
         textcolor(4);
         cprintf("%c", gr[index]);
         }

 _setcursortype(_NOCURSOR);

 gotoxy(1, hc+4);

 ch = bioskey(0);



         ranx = rand () % 9;
         ran = ranx;

 }
 clrscr();
 exit(0);
 textcolor(15);

}
Obtain help in making decisions
from a random number
generator.

DECIDE
(executable works on older computers or in DOSBox on newer pc's)