Skip to content

Huginode/CardChecker--

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CardChecker++

Credit card validator in c++ using luhn's algorithm

Table of Contents
  1. Description
  2. Luhn
  3. Installation
  4. Issues

Description

CardChecker++ is a credit card validator written in c++. I implemented luhn's algorithm using the built-in vector library in c++.

Luhn's algorithm

Figuring how the luhn algorithm works was by far the hardest thing I had to do for this projects. It's not necessarily complicated, it's just that there are either no explanations, or wrong ones, or it's uncomprehensible. This algorithm utilizes 3 steps.

  • From the rightmost digit double every second digit. (excluding the rightmost one)
  • For every doubled digit that is superior to 9 sum its two figures.
  • Then sum all the digits and see if the sum can be divided by 10.

Source: https://youtu.be/wsphC8V36i0?list=LL

Installation instruction

You can use it by downloading the creditCardValidator.cpp file and compiling it using g++ or gcc

eg:

  • g++ creditCardValidator.cpp -o name

Known Issues

  • There is a bug in the algo when it needs to sum the duble of 5

About

A credit card validator using Luhn algorithm, just like the original program.

Resources

License

Stars

Watchers

Forks

Languages