English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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 in Computers & Internet Programming & Design

For example, if the input.txt holds


3 4
4 9 6 1
2 2 1 4
3 9 6 8

then the file output.txt will hold

4 3
4 2 3
9 2 9
6 1 6
1 4 8

2006-12-11 03:54:05 · update #1

3 answers

Do you own homework. At least attempt it and post your problems that you are having.

2006-12-11 04:46:48 · answer #1 · answered by Jason C 2 · 2 0

everybody's existence touches some thing or somebody. So now a narrative- a guy in a gasoline station that i could flow to as quickly as a week and small communicate approximately trouble-free issues rapid substitute yet continually placed a grin on my face. 3 weeks with out him and that i replaced into feeling unhappy, the place did he flow - fired, extra beneficial interest? I noted as and asked the place replaced into this guy, i did no longer even understand his call - died from a snowmobile accident - I cried, i replaced into one in each and every of his best followers. solid Poem, i'm chuffed i discovered it.

2016-12-30 06:32:21 · answer #2 · answered by Anonymous · 0 0

Seems simple enough, but my guess is that this is probably a school assignment.

I can't just give you the answer, but send me an email with what you have so far and I'll guide you through completing it.

mike dot resnick at sbcglobal dot com

(replace the dot and at with . and @)

2006-12-11 04:31:54 · answer #3 · answered by BigRez 6 · 0 0

fedest.com, questions and answers