I am tring to print an array of 100 elements in a grid like pattern.
ex:
+0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000
+0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000
+0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000
+0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000
The problem is that Memory[0] is printed on a line by itself...
Let's say I've populated the array (somewhat) with the following values:
1007, 1008, 2007, 3008, 2109, 1109, 4300
It get's printed as:
+1007
+1008 +2007 +3008 +2109 +1109 +4300 +0004 +0006 +0010
+0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000
+0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000
+0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 etc...
The code below is what I am using to do the output. I've fiddled with
it for so long now, i'm almost sure there is no solution to this
problem...If you have any ideas, feel free to let me know. Thanks.
(p.s. everything missing std:: is in global namespace)
counter = 0;
while (counter <= 100){
cout << showpos << setfill('0') << setw(5)
<< std::internal << Memory[counter] << " ";
if (counter % 10 == 0)
cout << endl;
counter++;
}
fb
--
Having read the tea leaves and disembowelled a newborn
goat and examined the entrails I can say with confidence
that you need to refactor the inner loop into a service
locator pattern and use a observer pattern to count the
number of cubits.
I can also say with confidence that you are going to get flamed.
-Peter Hickman