I'm having a problem with a part of my code that is designed to take a number (code) and extract the individual digits using a functino call for use later in the program. (At this point in the program I have alreay input the code number as an int)
void extractDigits(int); was my function prototype.
extractDigits (&code); was what I had in the main function.
void extractDigits(int& code)
{
int base, digit1, digit2, digit3, digit4, digit5;
base = code;
digit5 = base % 10;
base /= 10;
digit4 = base % 10;
base /= 10;
digit3 = base % 10;
base /= 10;
digit2 = base % 10;
base /= 10;
digit1 = base % 10;
}
This was my function definition after the main function.
The main problem that I am having with this is how to return the value of the digits to the main function after the function call so that they can be used later in the program and not just in the scope of the function call above.
Any ideas would be greatly appreciated.