equal parts of string in int

Hello

i'm looking for a way to split a string in parts of 2 characters and then put them
in an int variable. so if my string = 123456. then i want:
int i = 12;
int k = 34;
int c = 56;

thanks in advance,
correct me if i made any mistakes.
This function will take a number "n" and split it into a vector of 2-digit numbers "doubles"
1
2
3
4
5
6
7
8
void splitnum(int n, std::vector<int>& doubles)
{
  while(n > 0)
  {
    doubles.push_back( n % 100);
	n /= 100;
  }
}
Topic archived. No new replies allowed.