add some comments
change export file extension
change export file extension
remove tmpNum
int t=0 => t=0
add delete [] r
use many delete [] operators