1. Define functions that return random voewls and random consonants - here's a random vowel function:

char RandomVowel()<br />{<br /> const char vowels[] = {'a', 'e', 'i', 'o', 'u'};<br /> // Use rand() to get a number between 0 and RAND_MAX. Dividing<br /> // by RAND_MAX+1 gives a number n such that 0 <= n < 1, so<br /> // multiplying by the number of characters in vowels gives a random<br /> // index into vowels<br /> const int index = (int)((double)rand()/(RAND_MAX+1) * sizeof(vowels));<br /> return vowels[index];<br />}

2. Build up a string using alternating calls to the random vowel and consonant functions - note that I've remembered about the upper case first character!

std::string name;<br /> name += (char)toupper(RandomConsonant());<br /> for(int i=1;i<desired-name-length;++i)<br /> {<br /> if (i%2==1)<br /> name += RandomVowel();<br /> else<br /> name += RandomConsonant();<br /> }

Obviously the desired name length should be chosen at random as well!