Changing an integer into a new integer with simple mathematical operations?

I need help with changing a 9 digit integer into a new 9 digit integer through simple mathematical operations. For example, I need to change 123456789 into the new digit 456123789. Sometimes I need to change a 9 digit integer into an 8 digit integer. An example is 789062456 into 62789456. If anyone can help me, I'd greatly appreciate it. I can ONLY use simple mathematical operations (addition, subtraction, multiplication, division and modulo). Thanks!
What is the problem?
123456789 + 332667000 = 456123789 for example. I suspect, that you did not state your problem fully.
Let me clarify. This is what the specifications for my assignment say:

You will be creating a program that reencodes encrypted text files. The files, which were used in the previous assignment, are comprised of several rows of five integers. The data is encrypted in two ways. First, the only appropriate data is found in even numbers; if the value in the file is an odd number, it must not be modified. Secondly, the data is encoded as the middle three digits of a nine digit number. The middle three digits represent an ASCII character value. You will have two tasks:

a) first, you must change the even-numbered encoded data so that the two or three ASCII digits are the first two or three digits in the number instead of the middle three digits; the odd-numbered values must not be modified but must be saved in their present position as found in the file. The data change will occur as follows: xxxyyyzzz will be changed to yyyxxxzzz; a specific example value 123456789 would be converted to 456123789. Note that since some of the ASCII values are two digits instead of three, the final number might be an eight-digit value instead of a nine digit value (e.g., 789062456 would be converted to 62789456).
Ok. first we will separate number in 3 three digit groups:

1
2
3
4
5
int origin = 123456789; //original number

int xxx =  origin / 1000000;
int yyy = (origin / 1000) % 1000;
int zzz =  origin % 1000;

Then we will construct rotated number:
1
2
int final = (yyy * 1000000) + (xxx * 1000) + zzz;
std::cout << final;
Just tested this and it worked perfectly. Thank you very much. I see the logic for why it works :).
Topic archived. No new replies allowed.