// july24ex1.cpp : Defines the entry point for the console application.
// Demonstration of FUNctions
//  Create random 'words' - They must be at least 2 characters long,
//   and the second letter must be a vowel.  First letter is cap.

#include "stdafx.h"
#include "stdlib.h"
#include "time.h"

void random_word (int);
void cap_letter(void);
void vowel(void);
void letter();

int main(int argc, char* argv[])
{    int num_letters, num_words;

	srand(time(NULL));

	printf("How many letters do you want in your random words? ");
	scanf("%d", &num_letters);

	for (num_words=1; num_words <= 10; num_words++)
		random_word( num_letters);


	return 0;
}   /*end main*/


void random_word (int count_let)  {
	int count;

      cap_letter();
	  vowel();
	  for (count=3; count<=count_let; count++)
          letter();
	  printf("\n");

}  /*end random_word */


void cap_letter(void) {

	printf("%c", rand() % 26 + 'A');
}  /* end cap_letter */

void vowel(void)  {

   int letter;
   letter=rand() % 5 + 1;
   switch(letter) {

      case 1: printf("a");break;
      case 2: printf("e");break;
      case 3: printf("i");break;
      case 4: printf("o");break;
      case 5: printf("u");break;

   } /* end switch */


} /* end vowel */

void letter() {

	printf("%c", rand() % 26 + 'a');

} /*end letter */