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

Info icon This 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 .
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 ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern