1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include "stdio.h"
#include "math.h"
#include <new>
int main() {
int *species;
species = new int[3,3];
int i, j;
int k;
// initialize to zero
for (int istampa=0; istampa<3; istampa++)
printf("%d , %d , %d\n",species[istampa,0], species[istampa,1], species[istampa,2]);
printf("\n\n\n");
k = 0;
for (i=0; i<3; i++){
for (j=0; j<3; j++) {
k++;
printf("i,j,k = %d,%d,%d\n",i,j,k);
species[i,j] = k;
// check after every cycle
for (int istampa=0; istampa<3; istampa++)
printf("%d , %d , %d\n",species[istampa,0], species[istampa,1], species[istampa,2]);
printf("\n");
}
}
delete species ;
return 0;
}
|