how to separate integers into four digists

I only know that (% and /) can be used but i don't know how e.g separating this numbers 14562398256921452365
into :
1456
2398
2569
2145
2365

please any one help
You could try converting the number (I'm assuming it is an integer) into a string and reading the number of characters you want. Perhaps something like (of course remember to include proper files):

1
2
3
4
5
6
int a = 12345678901234567890;
string str;
ostringstream ConvertStream;
ConvertStream<<a<<flush;
str = ConvertStream.str();
// then read from the string 


This is just the first way that I thought of. There are probably better, more efficent ways than this.
what you could try is to take your integer 14562398256921452365 and divide it by the the correct number to get 1456 so it would be 14562398256921452365 / 1000000000000000. Then you get 1456 you then take the remainder of your answer which is 2398256921452365 and divide that then by 100........ so you get 2398, then the remainder of that and so forth. Remainder is % remember.
Topic archived. No new replies allowed.