// july10ex1.cpp : Defines the entry point for the console application.
// This program creates random melodies
//This program creates a melody which keeps going until you happen to choose
// three DO's in a row.
#include "stdafx.h"
#include "stdlib.h"
#include "time.h"

int main(int argc, char* argv[])
{    int note, count_notes=0;
     int num_dos=0;
     srand(time(NULL));

	 do {
         note = rand() % 8 + 1; 
		 count_notes++;

		 switch (note) {

		  case 1: printf("Do1 \n");
			  num_dos++;
			 break;
		  case 2: printf("Re \n");
			              num_dos=0;
			 break;

		  case 3: printf("Mi \n");
			  			  num_dos=0;
			 break;
		  case 4: printf("Fa \n");
			  			  num_dos=0;
			 break;
		  case 5: printf("So \n");
			  			  num_dos=0;
			 break;
		  case 6: printf("La \n");
			  			  num_dos=0;
			 break;
		  case 7: printf("Ti \n");
			  			  num_dos=0;
			 break;
		  case 8: printf("Do2 \n");
			   num_dos++;

		 } /* end switch note */

	 } while (num_dos <3);

	 printf("Your melody was %d notes long\n", count_notes);


	
  printf("**********\n");
	return 0;
}