Checksum calculating program

P

Protoman

How would I make a program to calculate a checksum? I have the code to
sum up the digits, but what then? Here's the digit summer:

template <unsigned int I>
int SumDigits()
{
return(I%10)+(SumDigits<I/10>());
}

template <>
int SumDigits<0>() {return 0;}

Some help? Thanks!!!!
 
V

Victor Bazarov

Protoman said:
How would I make a program to calculate a checksum? I have the code to
sum up the digits, but what then? Here's the digit summer:

template <unsigned int I>
int SumDigits()
{
return(I%10)+(SumDigits<I/10>());
}

template <>
int SumDigits<0>() {return 0;}

Some help? Thanks!!!!

What checksum algorithm do you want to employ? There are many. Have
you tried looking for their descriptions and implementations on Google?

V
 
P

Protoman

Victor said:
What checksum algorithm do you want to employ? There are many. Have
you tried looking for their descriptions and implementations on Google?

V

The alg they use for UPC barcodes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top