Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with writing this program in c++ Please help!!! 2. Write a program that takes in a number of integers from a user
I need help with writing this program in c++
Please help!!!
2. Write a program that takes in a number of integers from a user and determines their validity using a (simplified) form of "the Luhn method" of verification. Here is the principle: 1. Starting with the first digit, double the value of every second digit. For example, in an 8 digit number, double the 1st, 3rd sth, and 7th digits (digits in odd places). Now, replace the digits in the odd places (in the original number) with the new doubled numbers you just generated. 3. Add up all the digits in this new number. If the final total is perfectly divisible by 10, then the credit card number is valid (Luhn check is satisfied), otherwise it is invalid. Your system should ask the user how many numbers they would like to enter. It should then ask for each number, one at a time (you can assume there won't be more than 16 numbers). Once they are all read in it should perform the calculation and notify them if it is valid or not. It should then ask if they want to process another number or exit. Here's an example series: Welcome to the number verifier... How many numbers will you be entering? >> 8 Enter #1: O Enter #2:5 Enter #3:3 Enter #4: 7 Enter #5:5 Enter #68 Enter #7: 7 Enter #8: 0 The string entered: 05 375870 The sum: 0+5+6+7+ 10+8+14 +0 50 This is divisible by 10 so it's validStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started