# include & lt iostream & gt-iostream header file
# include < fstream >-file stream header file
Use namespace std- use standard
Int main (int argc, char * argv [])-main function. The number of argc command line position parameters, argv[], and the content of command line position parameters.
int a[4][4]={ 1,2,3,.。 . }; 4x4 integer array a, declaration and initialization.
float c[5][5]={ .。 } 5x5 floating-point number group b, declared and initialized.
int i,j; -integer variable I, j declaration
Cout & lt& lt" 4*4 plastic array element address: "
for(I = 0; I<4; i++)for(j = 0; j & lt4; j++)cout & lt; & lt& ampa[I][j]& lt; & ltendl- Double loop, the screen outputs an array element address.
Next is the screen output string, line break, double loop, and the address of the screen output C array element.
Ofstream out- declares the output file stream, and the name of the stream comes out.
out.open ("h: \\file.txt ",IOs::out); -Open the disk file with the file name of H:\file.txt and ios::out as the output (write) file.
If (! Out)-If the file cannot be opened (! idspnonenote)。 Out) is true.
{cout & lt& lt "Unable to open file"
Out<& lt" 4*4 plastic array element address: "
for(I = 0; I<4; i++)for(j = 0; j & lt4; j++)out & lt; & lt& ampa[I][j]& lt; & ltendl-double loop, write the array element address to the disk file.
Out<& lt" 5*5 real array element address: "
for(I = 0; I<5; i++)for(j = 0; j & lt5; j++)out & lt; & lt& ampc[I][j]& lt; & ltendl
-Double loop, writing the address of the C array element to the disk file.
out . close(); -Close the disk file.
Returns 0; -Return 0, exit main (), and the program ends.
-
for(I = 0; I<5; i++)for(j = 0; j & lt5; j++)out & lt; & lt& ampc[I][j]& lt; & ltendl
C output in line order:&; c[0][0],& ampc[0][ 1],& ampc[0][2]..& ampc[0][4],& ampc[ 1][0],...& ampC[4][4]。 Every address is packed.
& indicates the address of the element without &; Is the value of the element.