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: -
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
Step by Step Solution
3.41 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
Heres the C program that fulfills the requirements C include include include include using namespace std bool isVowelchar letter string vowels aeiou return vowelsfindletter stringnpos int generateRand...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started