Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Many companies utilize a random password generator to assign initial passwords to users. In this homework you have been given a list of 50 employees

Many companies utilize a random password generator to assign initial passwords to users. In this homework you have been given a list of 50 employees stored in a file called employees.txt and a list of 50 passwords stored in a file called passwords.txt. Your objective is to randomly assign each password in passwords.txt to an employee in employees.txt.
Data:
You can get the data for this homework by invoking the following commands:
wget tars.clarkson.edu/cs141/lab8/employees.txt
wget tars.clarkson.edu/cs141/lab8/passwords.txt
Task:
Write a program called randomPwd.cpp that will read in the data from employees.txt and randomly assign each employee a password from passwords.txt. Once you have randomly assigned the passwords write the employee names and passwords to a file called empPasswords.txt. Each line in empPasswords.txt should have the name of the employee followed by a space and then their password.
Your program must contain the following four functions:
1. A function to read in the employee names from employees.txt and store it in an
appropriate data structure, such as a 2D array or struct.
2. A function to read in the passwords from passwords.txt and store it in an appropriate
data structure, such as a 1D array or struct.
3. A function to shuffle the passwords that was read in Step 2 and assign them to the
employees read in Step 1.
4. A function to write the employee names and their passwords to the output file
empPasswords.txt.
NOTE: Your program cannot assign the first employee the first password, or the first employee
the fiftieth password. The assignment of passwords must be done randomly.
Hint:
The following link has a tutorial on how to generate random numbers:
http://www.cplusplus.com/reference/cstdlib/rand/
You may find it easiest to create an array of 50 unique randomly generated integers in Step 3 and use that as an index scheme to assign each user a password.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago