I'm trying to make sure that the second column in the output is aligned and it seemed like setw would be the solution but not matter what I do the second column is always off. This is the output I get from the code below...
1> 123
10> 234
but I want it to be...
1> 123
10> 234
The only other thing I can think of is to actually get the number of digits of what the actual number of elements are and the index then do some sort of length calc from that. That seems like a lot of handling just to get the second column right aligned.
I also tried << right but since I'm printing line by line in a loop this won't make a difference
int main()
{
int array[2] = {123,234};
int array2[2] = {1, 10};
for(int i = 0; i < 2; i++){
cout << array2[i] << "> " << setw(4) << array[i] << endl;
}
return 0;
}