// july14ex1.cpp 
//Keeping going until red-white-blue comes up in that order
#include "stdafx.h"
#include "stdlib.h"
#include "time.h"

int main(int argc, char* argv[])
{    int jelly=9, num=0, last=9, twoago=9;
     srand(time(NULL));

     
	 while ( (jelly !=3) || (last != 2) || (twoago !=1) ) {

		num++;    /* count bean chosen */

		twoago = last;
		last = jelly;

        jelly=rand() % 3+ 1;

        printf("You chose a ");

        switch (jelly) {
		case 1: printf("red  ");
			break;
		case 2: printf("white");
			break;
		case 3: printf("blue ");

		} /* end switch jelly */

     printf("\n");

	 } /* end while jelly */

    printf("\nIt took %d beans to find red-white-blue combo\n", num);

	return 0;
}