Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help. Thanks alot. Project Six Strings and Vectors Write a C++ program that allows the user to input two values: 1- user name into

please help. Thanks alot.

Project Six Strings and Vectors Write a C++ program that allows the user to input two values: 1- user name into one string variable userName 2- password into another string variable password The program then concatenates the strings into a third string variable login login takes the form userName, password (note the comma and space) For example pmadison, abc123 The combined strings will then be stored in a string vector. See Display 8.4 for sample code concatenating strings. Before combining the strings, write a function named CheckPassword to validate the entry. The function should verify the following: o Length of the string is at least 5 characters. o Cannot contain a space. o The string cannot contain all digits. Repeat the loop until the user enters a valid password. This is a good place to use a do loop (but the loop in main should remain a while loop). The function should return the string to main after the entry is correct. Repeat the process of entering user names and passwords until the user enters 0 for userName. Output the list to the screen by displaying the vector items (the logins) one per line after building the vector. See lines 18-20 in 08.09.cpp. Purpose of this project Develop C++ program with the following new features: o Strings Use the string class (461 477). o Vectors Check the example on page 479. o do loop page 87. Advice from the Instructor: o Use the attached program 08.09.cpp (Display 8.9) as the code on which to base this program. Add this cpp to a project. Run it to see how it works. Delete lines 14 and 15 since they are mainly diagnostic. Change 08.09.cpp so it uses a string vector. *Be sure to add #include Set up the string password = abc123; and test the vector code first. After the vector code in main works: o Change string password = abc123; to string password; o Add the CheckPassword function. o The call should look like this: password = CheckPassword(); o The CheckPassword function returns the password after it is validated. The getline for password should be in CheckPassword. o Use getline to input the user name and password. Here is the syntax: getline(cin, s); s is declared as a string. o Dont forget the Class Standards for writing programs. The output in 08.09.cpp does not meet the Class Standards. Extra credit: Add the code in the attach password.cpp file so that the password doesnt display on the screen.

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

Step: 3

blur-text-image

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions