I need to create a program that, upon collecting two sets of five digit bar code numbers:
a.Sums the second and forth numbers in the manufacturers code.
b.Sums the first, third, and fifth numbers in the product code.
c.Sums the results of steps a and b and multiplies the total by 3.
d.Sums the first, third, and fifth numbers in the manufacturers code.
e.Sums the second and fourth digits in the product code.
f. Sums the results of steps d and e and adds the results from step c.
g. Takes the remainder when the result of step f is divided by 10.
h. Subtracts the results of step g from 10. Compares this result to the check digit entered by the user. If the result and check digit are equal (if the Boolean value of the comparison is 1.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
// UPC.cpp : main project file.
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int manufacturerCode, productCode, checkDigit = 0;
cout << "Enter five digit manufacturer code ";
cin >> manufacturerCode;
cout << "Enter five digit product code ";
cin >> productCode;
return 0;
}
|
This is as far as I've gotten. How can I seperate the digits from the entered code for calculation by only using modulus, multiplication, and subtraction?