1. I wld like to print a random letter in English alphabet. But here the condition is i should avoid A, E, I, O and U. Each time i run the program it should generate only consonant alphabet. How it is possible?
1. the right way - make an array of all consonants, and only choose from those.
2. the lazy way - choose an alphabet randomly, and try again if you hit a vowel.
choosing a letter can be done by, for example -
Code:
char c = 'a' + (rand() % 26);
2. How can we print a random character. Here the condition is it may print it from small case letters (a-z0 and from numerals (0-9). That means if we execute the program it should print a character either from small alphabets or from numerals.
Make a char array of candidates, and randomly choose from those.