lubyanka:my.projects exs$ ./a.out
How many pancakes did person 0 eat? 2
How many pancakes did person 1 eat? 4
How many pancakes did person 2 eat? 6
How many pancakes did person 3 eat? 8
How many pancakes did person 4 eat? 10
How many pancakes did person 5 eat? 12
How many pancakes did person 6 eat? 14
How many pancakes did person 7 eat? 16
How many pancakes did person 8 eat? 18
How many pancakes did person 9 eat? 20
temp={0, 2}
temp={3, 8}
temp={9, 20}
Person 9 ate 21 pancakes - the most of anyone!
I can't see why the result is being incremented before dumping to cout...
int temp[1][1];
temp[0][0] = foo[0][0];
temp[0][1] = foo[0][1];
You have defined temp multi-demisional array with dimensions of 1, 1 and yet you use dimensions of 1, 2. Try changing your temp definition to int temp[1][2];