summaryrefslogtreecommitdiff
path: root/27_matrix_input/README
blob: 26031a6b27f4c9bc3e30cf5b3e3edf16bfa1d9b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
In a previous project, you wrote a function

 void rotate(char matrix[10][10])

which performed 90 degree clockwise rotation of a 10x10
matrix.   In that assignment, we gave you a compiled
object file which read the input matrix from a file,
called your function to do the rotation, and then
printed the result to the screen. 

In this assignment, you will write the code that we
previously gave you, making the complete program on your own.
You are encouraged to make use of your previously written
rotate function in this assignment.

For this problem, you will be writing a program which 
performs a 90 degree clockwise rotation of a 10x10 matrix.
There is nothing special about a 10x10 matrix---I just need
to fix the matrix size, since we have not learned about dynamic
memory allocation yet, so we do not have the knowledge needed
to read in any size of matrix.

To keep the input processing simple, the matrix will be a matrix
of characters (so you will have something like
  char matrix[10][10]
in your program), which will be read from a file.  Each line
in the input file should contain 10 characters (plus a newline).

Requirements:
=============
  - Create a file called rotateMatrix.c
        - Your program will take one command line argument, a string
    specifying the input file to read.
  - The input file should contain 10 lines, each of which
    have 10 (non-newline) characters (plus a newline).
  - Your program should then rotate this 90 degrees clockwise,
    and print the result on stdout.
    Note that sample.txt provides sample input, and 
    sample.out provides sample output.
  - If there are any errors, your program should print an
    appropriate message to stderr, and exit with EXIT_FAILURE.
  
Hints:
------
  - You may find the strchr useful for error checking that
    you read a proper line (10 non-newline characters, then a newline).