I have to write a program validating credit card numbers using Luhn's algorithm. I am having trouble getting my last function to work. For a credit card number i'm supposed to double every second digit from right to left, and sum them (note double digits, like 10=1+0), and then add the rest of the digits together, and total both sums. After that, I make sure it's divisible by 10. Can anyone see what's wrong with my code? Thank you.
bool isValid(string creditCardNumber)
{
int totalSum;
int evenSum;
int oddSum;