{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

assg1.pdf - CSCI1120 Introduction to Computing Using C Fall...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI1120 Introduction to Computing Using C++, Fall 2016 Department of Computer Science and Engineering, The Chinese University of Hong Kong Copyright © 2016 CSE, CUHK Page 1 of 2 Assignment 1: Check Digit Computation Due: 20:00, Tue 27 Sep 2016 Full marks: 100 Introduction Every credit card number contains a check digit at its rightmost, which is used for simple error detection. It can be used to protect against accidental errors such as a mistyped digit or the permutation of two successive digits. In this assignment, you will write a program that computes the check digit of a partial credit card number. For simplicity, we assume that a card number has exactly 16 digits in the form 𝑑 1 𝑑 2 𝑑 3 𝑑 4 𝑑 5 𝑑 6 𝑑 7 𝑑 8 𝑑 9 𝑑 10 𝑑 11 𝑑 12 𝑑 13 𝑑 14 𝑑 15 𝑑 16 , in which 𝑑 1 … 𝑑 15 is the 15- digit partial card number obtained from the program user and 𝑑 16 is the check digit to be computed. To compute the check digit of a partial card number, we can use the Luhn algorithm a described below: 1. Double the odd-positioned digits 𝑑 1 , 𝑑 3 , 𝑑 5 , 𝑑 7 , 𝑑 9 , 𝑑 11 , 𝑑 13 , and 𝑑 15 .
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}