Answered step by step
Verified Expert Solution
Link Copied!

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++

image text in transcribed

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 valid

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 Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions

Question

43% of the population are Internet users (EMOR, autumn 2002).

Answered: 1 week ago