- #1
- 9,568
- 775
Let's say you have a 4 digit "odometer" using just the digits 0 through 7. So it starts at 0000 and works its way up to 7777. So, for example, the next reading after 0007 is 0010 etc. There are ##8^4 = 4096## readings before it rolls over. I want to create and initialize an array with ##4096## rows and ##4## columns with the elements of each row being the corresponding digits (integer type). Like this:$$
\begin {bmatrix}
0 & 0 & 0 & 0\\
0 & 0 & 0 & 1\\
& & \cdots & \\
7 & 7 & 7 & 6\\
7 & 7 & 7 & 7
\end {bmatrix}$$
I'm just experimenting with C##^{++}## in Microsoft Visual Studio. A code snippet for this would save me a lot of time and likely be more efficient than what I might come up with.
\begin {bmatrix}
0 & 0 & 0 & 0\\
0 & 0 & 0 & 1\\
& & \cdots & \\
7 & 7 & 7 & 6\\
7 & 7 & 7 & 7
\end {bmatrix}$$
I'm just experimenting with C##^{++}## in Microsoft Visual Studio. A code snippet for this would save me a lot of time and likely be more efficient than what I might come up with.