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 1st initial followed by the second

non-vowel 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 non-vowel letter if the rst

name doesn't include a non-vowel letter.

- The 6-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 inputs/outputs:

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 r123456

Enter your f i r s t name : Aaron

You ent e r ed : Aaron

Your u s e r i d i s : ar654321

Enter your f i r s t name : Joe

You ent e r ed : Joe

Your u s e r i d i s : jx142536

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 2=l e t t e r and 6=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

1 Expert Approved Answer
Step: 1 Unlock

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... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!