Write a program that prompts the user for their rst name, then generates a userid formed by
Question:
Write a program that prompts the user for their rst name, then generates a userid formed
by two letters and six digits, as follows:
The two letters come from the rst name, that is the st initial followed by the second
nonvowel letter from the rst name. The vowels are the characters a e i o and u Design
the function is vowel to decide whether a letter is vowel or not, and in its implementation,
call the find function of string library. Use letter x as the nonvowel letter if the rst
name doesn't include a nonvowel letter.
The digit portion is generated randomly. Design the function generate random number
to generate a random number between two integers. Call the cstdlib library functions
srand and rand in the implementation of this function.
Here are sample program inputsoutputs:
Enter your f i r s t name : Sarah
You ent e r ed : Sarah
Your u s e r i d i s : s r
Enter your f i r s t name : Aaron
You ent e r ed : Aaron
Your u s e r i d i s : ar
Enter your f i r s t name : Joe
You ent e r ed : Joe
Your u s e r i d i s : jx
Test your program with names Sarah, Aaron, and Joe as input.
Here is a template to get started:
Fi l e : us e r i d cpp
This program g ene rat e s a l e t t e r and d i g i t us e r i d
Programmer : your name Date :
#include
#include
#include rand and srand
#include t ime to g e t the cur r ent t ime
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang