06 Jul C program
You are required to develop a program that will perform security authorisation based on access codes. The access codes are 4 single-digit integer numbers between 0-9. The program should allow a user to enter a code, encrypt the number and compare it to an authorised access code. The program should also allow the user to decrypt an encrypted code.
When your program begins executing, the default authorised access code is 4523 (encrypted form of 1234 – see encryption algorithm below). This code must be stored in a 1-D array called access_code and should not be changed. You should use a different 1-D array to read the code entered by the user.
Your program should be menu-driven and must display a simple menu when run. The menu should include the following options:
1. Enter code
2. Encrypt code and verify if correct (i.e., matches authorised access code)
3. Decrypt code
4. Display the number of times the code was entered (i) Successfully (ii) Incorrectly
Note:
• Each menu option must be implemented in a separate function, i.e. modularized.
• All functions must pass parameters using Pass by Reference. Do NOT pass parameters using pass by value.
• All reading and writing to/from arrays must use pointer notation – not subscript notation (i.e. using [ ])
Requirements:
(Each implemented in a separate function):
1. Enter 4 single-digit integers. Perform any necessary validation (errorchecking).
2. Encrypt the code entered. You should use the following algorithm to encrypt the 4 single-digit integers:
Encryption Algorithm:
– Swap the 1st number with the 3rd number.
– Swap the 2nd number with the 4th number.
– Add 1 to each number. – If any number has a value equal to 10, change this value to 0.
3. Compare the encrypted number from step 2 with the access code (4523) stored in the 1-D array called access_code. If the 2 codes match, display a message saying CORRECT CODE. If the 2 codes do not match, display a message saying ERROR CODE.
4. Provide an option to allow a user to decrypt an encrypted code. You should use the following algorithm to decrypt the encrypted code only:
Decryption Algorithm:
– Subtract 1 from each number.
-If any number has a value equal to -1, change this value to 9.
– Swap the 1st number with the 3rd number.
– Swap the 2nd number with the 4th number.
5. Count the number of times a user entered a correct/incorrect code after it is encrypted and compared to the access code in each run of the program.
6. The program should terminate gracefully.
Features to include:
• After each option has finished, your program should return to the main menu and allow the user to select another option.
• The user should only be allowed to encrypt their code (i.e. select option 2) if the code is NOT already encrypted.
• The user should only be allowed to decrypt their code (i.e. select option 3) if the code IS already encrypted.
• Only encrypted codes should be compared with the access-code (option 2).
• Display appropriate error messages to handle any errors.
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.
