Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Java Programming And Data Structures Comprehensive Version

Authors: Y. Daniel Liang

12th Edition

0136520235, 978-0136520238

More Books

Students also viewed these Programming questions

Question

What is a multi - cloud strategy?

Answered: 1 week ago