a big number to separate characters

Hey all!
I need to separate a number to different numbers, for example something like this

int i,x,y,z;
i = 123;

and i need the x value to be 1, y value to be 2 and x value to be 3
sorta like char number[3];, so number[1] would have a value of 1, number[2] the value of 2 and so on.

Can someone explain how to do this?
Hint: % and / operators
You can use the function itoa() however it is not standard and may not be included with your copiler. E.g:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <cstdlib>

int main()
{
    int i = 123;
    char str[3];
    
    itoa(i, str, 10);
    
    std::cout << str[0] << str[1] << str[2];
    
    std::cin.get();
    return 0;
}


You should really use bluezor's hint though and go down that path.
Topic archived. No new replies allowed.