I've come across this problem several times and it gets me each time. Say now the user inputs a 9 digit bank card number, how would I perform individual operations on each digit to create an algorithm. eg Multiply every second digit by 2 etc.
Would it be wise to read it into a string ?
thanks
1) you can read it into string from the beginning
2) You can read it as a numbe and convert it into string later
3) you can use simple algorithm for extracting digits from number:
1 2 3 4
while (number != 0) { //Loop while number still has digits
int digit = number % 10; //Here is current last digit of the number, do anything you want with it
number /= 10: //cut last digit from number
}