CG 195 - C++ Programming
Lab 5  -  Visa Credit Card Numbers

OBJECTIVES:

INTRODUCTION:
Credit Card Numbers
A credit card number has a built in check for validity. Start with the credit card number below:
 0699 0043 1313 9642

Starting at the right take all digits in odd number positions and bring them straight down. The
digits in the even positions should be doubled. If the doubled value exceeds 9 subtract 9.
 0 6 9 9 0 0 4 3 1 3 1 3 9 6 4 2
 0 6 9 9 0 0 8 3 2 3 2 3 9 6 8 2
The sum of these digits is:
 0 + 6 + 9 + 9 + 0 + 0 + 8 + 3 + 2 + 3 + 2 + 3 + 9 + 6 + 8 + 2 = 70
VISA credit card numbers must be divisible by 10 and therefore this is a valid VISA credit card

DETAILS:
Read all of the digits for the credit card number except for the last digit (15 digits). Besides the 15 digits, there may be spaces that should be ignored. You should read this information using the C++ command
    cin.getline(array, size).

You are to figure out the last digit and display all 16 digits with the originally included spaces. Also you should display an error message if the user types anything in except digits and spaces. You should also give an error message if the user doesn't type in enough or too many digits.

INPUTS:
A line that contains 15 digits with spaces.

OUTPUTS:
Error messages if the user types in the wrong information.

15 digits with spaces.

EXAMPLE: (User input is in bold faced font)
Type in the first 15 digits of a Visa credit card (you may include spaces)  0699 0043 1313 964
The complete Visa credit card number is  0699 0043 1313 9642
Do you wish to continue (y/n)? n
end of program.

DETAILS:
Don't forget the following: