
please wait
|
|
|
|
|
|
PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code. Along with the proper indenting it makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/ Hint: You can edit your post, highlight your code and press the <> formatting button. You can use the preview button at the bottom to see how it looks. I found the second link to be the most help. |
long int **matrix
,but never give it a value, i.e., an address or a size. the line if (infile(input, "%ld", &matrix[i][j]) < 0)
you are trying to give an element of "matrix" a value, but "matrix" has no size, so it is unknown what bit of memory you are writing to.
|
|
0 1 2 3 1 2 3 4 2 3 4 5 1 0 1 2 2 1 2 3 3 2 3 4 2 1 0 1 3 2 1 2 4 3 2 3 3 2 1 0 4 3 2 1 5 4 3 2 1 2 3 4 0 1 2 3 1 2 3 4 2 1 2 3 1 0 1 2 2 1 2 3 3 2 1 2 2 1 0 1 3 2 1 2 4 3 2 1 3 2 1 0 4 3 2 1 2 3 4 5 1 2 3 4 0 1 2 3 3 2 3 4 2 1 2 3 1 0 1 2 4 3 2 3 3 2 1 2 2 1 0 1 5 4 3 2 4 3 2 1 3 2 1 0 0 5 2 4 1 0 0 6 2 1 1 1 5 0 3 0 2 2 2 0 4 5 0 0 2 3 0 0 0 0 0 5 5 2 2 2 4 0 0 0 5 2 2 10 0 0 5 5 1 2 0 5 0 10 0 0 0 5 1 1 0 2 0 2 10 0 5 1 1 5 4 0 0 2 0 2 0 5 0 10 5 2 3 3 6 0 5 10 0 1 10 0 0 0 5 0 2 4 5 0 0 1 5 0 0 0 10 10 1 5 2 0 5 5 2 0 0 0 5 0 1 0 2 5 1 4 3 5 10 5 0 2 1 0 2 5 1 0 3 0 10 0 2 0 |
|
|
kbklpl wrote: |
---|
Can I know why I can't do as the coding I had above in the main function? |
cout << **d
you will output just one element - the first element in the first row. In this case that happens to be 0.kbklpl wrote: |
---|
I also tried having the 'for' loop from your write_matrix function into the read_matrix function, but it won't work either. |
|
|