h_hendizadeh
دوشنبه 05 مرداد 1383, 01:28 صبح
<span dir=ltr>Dear my friend
To explain better my problems I numbered them as follow:I've also attached the file of this email.
1. Time and Hard Drive Consumption: I could finally take some good answers from my code but it is very time consuming and when the operation system is Windows 98 the driver C: (which I installed Visual C++) will be inflated until the capacity of driver C: will be filled. For example if I have 2 Giga byte for driver C: , after about 20 Minutes it will be filled ,I think I must pay more attention to destructors and my two and three-dimensional arrays .
2. Three-Dimensional Array: How I can create and delete a three-dimensional array? I used this method in my code:
TO Create:
int ***StartTime = new int**[FS];
for (int i = 0;i < FS;i++)
StartTime[i] = new int *[JS];
for ( i = 0;i < FS;i++){
for(int j = 0;j < JS;j++)
StartTime[i][j] = new int [MS];
}
So then I create a 3- Dimensional array of StartTime[FS][JS][MS]
To Delete:
The First Method:
for(i=0;i<MS;i++)
delete [] StartTime[i];
for(i=0;i<JS;i++)
delete [] StartTime[i];
delete [] StartTime;
The Second Method:
for(i=0;i<MS;i++){
for(int j=0;j<JS;j++)
delete [] StartTime[i][j];
}
delete [] StartTime;
The Third Method:
delete []** StartTime;
3. Optimize the code: Would you please introduce me a book to optimize the code especially when we have many 2 and 3-dimentional arrays? And then get rid of that time and hard consuming.
</span>
To explain better my problems I numbered them as follow:I've also attached the file of this email.
1. Time and Hard Drive Consumption: I could finally take some good answers from my code but it is very time consuming and when the operation system is Windows 98 the driver C: (which I installed Visual C++) will be inflated until the capacity of driver C: will be filled. For example if I have 2 Giga byte for driver C: , after about 20 Minutes it will be filled ,I think I must pay more attention to destructors and my two and three-dimensional arrays .
2. Three-Dimensional Array: How I can create and delete a three-dimensional array? I used this method in my code:
TO Create:
int ***StartTime = new int**[FS];
for (int i = 0;i < FS;i++)
StartTime[i] = new int *[JS];
for ( i = 0;i < FS;i++){
for(int j = 0;j < JS;j++)
StartTime[i][j] = new int [MS];
}
So then I create a 3- Dimensional array of StartTime[FS][JS][MS]
To Delete:
The First Method:
for(i=0;i<MS;i++)
delete [] StartTime[i];
for(i=0;i<JS;i++)
delete [] StartTime[i];
delete [] StartTime;
The Second Method:
for(i=0;i<MS;i++){
for(int j=0;j<JS;j++)
delete [] StartTime[i][j];
}
delete [] StartTime;
The Third Method:
delete []** StartTime;
3. Optimize the code: Would you please introduce me a book to optimize the code especially when we have many 2 and 3-dimentional arrays? And then get rid of that time and hard consuming.
</span>