[email protected]:-/COP3363>g++ -std-c++11 PasswordPtr.cpp [email protected]:-/COP3363>a.out Welcome to the Password Program! 1) Display the Password 2) Change the Password. 3) Display whether or not the password is valid 4) Locate the password character with the lowest ASCII code. 5) Sort the password characters: 6) Add another character to the password 7) Quit Select an option (1..6)..1 Password K 9507ttu 1) Disp the Password 2) Change the Password 3) Display whether or not the password is valid 4) Locate the password character with the lowest ASCII code 5) Sort the password characters. 6) Add another character to the password 7) Quit Select an option (1..6)..4 The password char with the lowest ASCII is S 1) Display the Password. 2) Change the Password. 3) Display whether or not the password is valid 4) Locate the password character with the lowest ASCII code 5) Sort the password characters. 6) Add another character to the password 7) Quit Select an option (1..6)..5 Sorted Password charsi Password $79 Kottu 1) Display the Password i 2) Change the Password 3) Display whether or not the password is valid 4) Locate the password character with the lowest ASCII code 5) Sort the password characters 6) Add another character to the password 7) Quit Select an option (16) 1 Password K9507ttu 1) Display the Password 2) Change the Password 3) Display whether or not the password is valid/ 4) Locate the password character with the lowest ASCII code
ort Sample Run: NOTE: not all possible runs are shown below. [email protected]:-/COP3363>g++ -std-c++11 PasswordPtr.cpp kworkselinprog6.cs.fsu.edu:-/COP3363>a.out Welcome to the Password Program! 1) Display the Password i 2) Change the Password 3) Display whether or not the password is valid. 4) Locate the password character with the lowest ASCII code. 5) Sort the password characters. 6) Add another character to the password 7) Quit Select an option (1..6)..1 Password K9507ttu 1) Display the Password 2) Change the Password 3) Display whether or not the password is valid 4) Locate the password character with the lowest ASCII code 5) Sort the password characters 6) Add another character to the password 7) Quit Select an option (1..6)..4 The password char with the lowest ASCITIS S 1) Display the Password. 2) Change the Password i 3) Display whether or not the password is valid 4) Locate the password character with the lowest ASCI code 5) Sort the password characters 6) Add another character to the password 7) Quit Select an option (1..6)..5 Sorted Password chars Password $79 Kottu 1) Display the Password 2) Change the Password 3) Display whether or not the possword is valid 4) Locate the password character with the lowest ASCII code 5) Sort the password characters 6) Add another character to the password. 7) Quit Select an option (1. 6. 1 Password: K9507EU nialay the Password
Using the following array: // may be declared outside the main function int NUM CHARACTERS -8; // may only be declared within the main function char passwordArray[NUM CHARACTERS]-['K','9','S',' char password -passwordArray; ', 'e', 'e', 'u'); Be sure to compile using g++ -std=c++11 PasswordPtr.cpp Write a C++ program to run a menu-driven program with the following choices: 1) Display the password 2) Change the password 3) Display whether or not the password is valid 4) Locate the password character with the lowest ASCII code 5) Sort the password characters 6) Add another character to the password 7) Quit
will lose points if you do not satisfy this requirement. . You must add code to your existing program to support adding a new score //allows user to add a character to the password char AddChar ToPassword(const char *password, int & NUM CHARACTERS); //here is how to call them from main case 4: //add a character to the password password- AddCharToPassword(password, NUM CHARACTERS); break; The AddCharToPassword function creates a new array that is 1 element larger than the password array, copies all the current elements in the password array to the new array, increases NUM_CHARACTERS by 1, prompts the user for a valid password character andladds it to the end of the new array, deletes the old array, and returns the new array. You must add all the required logic to the program so that when the user enters a 6, a new character is properly added. (45 points) requiring any changes 2) You must rewrite all the functions from the Password Program - Part 2 to only accept parameters that are either constant pointers or pointers and pass NUM_CHARACTERS as a parameter. In addition, you may NOT use subscript notation. You must replace this with pointer notation. Hint: password "(password + i) All functionality in the original program must remain intact. (20 points): Example
ort Sample Run: NOTE: not all possible runs are shown below. ort Sample Run: NOTE: not all possible runs are shown below. [email protected]:-/COP3363>g++ -std-c++11 Passwor
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am