A data file called input.txt contains two integers, m, n, specifying the dimensions of an m x n matrix, followed by m lines each with n integer values representing the contents of the matrix. Write a C program to open the file, read m and n, dynamically allocate a two-dimensional array to hold the data and then read the matrix values. Write to a file called output.txt the values n, m followed by n lines of m values each, representing the transpose of the input matrix, i.e., the first column of the input matrix becomes the first row of the output matrix, and so on. Note, the file I/O in this question requires use of functions fopen, fprintf, and fscanf rather than simple redirection.
2006-12-11
03:53:40
·
3 answers
·
asked by
skyrider
2