summaryrefslogtreecommitdiff
path: root/27_matrix_input/README
diff options
context:
space:
mode:
authorHaidong Ji2022-04-15 15:51:30 -0500
committerHaidong Ji2022-04-15 15:51:30 -0500
commit442a49ad5a48d417345959b903ae6a6d32d55759 (patch)
treec7127bb497e5e439018b1915e0136eec2c9cb124 /27_matrix_input/README
Great C programming funHEADmaster
Excellent fundamentals and displine training, many tools and techniques exercises: gdb, emacs, valgrind, git
Diffstat (limited to '27_matrix_input/README')
-rw-r--r--27_matrix_input/README47
1 files changed, 47 insertions, 0 deletions
diff --git a/27_matrix_input/README b/27_matrix_input/README
new file mode 100644
index 0000000..26031a6
--- /dev/null
+++ b/27_matrix_input/README
@@ -0,0 +1,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).
+