$30.00
Description
A Latin Square is an N N matrix with N diﬀerent symbols such that each row and column has the N diﬀerent symbols occurring exactly once and without repetitions. For example, the followings are 3 3 Latin Squares.

2_{B}
C
_{A}3
2_{C}
A B^{3}
2_{B}
A C^{3}
A B
C
A B
C
A C
B
4_{C}
A
B^{5}
4_{B}
C
A^{5}
4_{C}
B
A^{5}
where we have used the first 3 alphabet letters for the symbols. In this assignment, please write a C program to perform exhaustive search for all possible Latin Squares given N, which is defined by macro as below, and the symbols are consist of the first N capital alphabets.
#if !defined(N)
#define N 3
#endif
Defining macro as shown above, it is possible to change the value of N while compiling. For example, if we want to change N from 3 to 4 we just need to do the following.

gcc DN=4 lab06.c
Then during preprocessing phase of compilation, the value of the macro is replaced by 4. You will need to make sure your program can handle general cases with N 3. Example of program outputs are (N=3):
Latin 
Square 1: 
A B 
C 
B C 
A 
C A 
B 
Latin 
Square 2: 
A B 
C 
C A 
B 
B C 
A 
Latin 
Square 3: 
A C 
B 
B A 
C 
C B 
A 
. . . 

. . . 
Latin Square 12:
C B A
B A C
A C B
Totoal number of Latin Squares found is 12
Notes.

Create a directory lab06 and use it as the working directory.

Name your program source file as lab06.c.

The first few lines of your program should be comments as the following.
/* EE231002 Lab06. Latin Squares ID, Name
Date:
*/

It is recommended to define the twodimensional matrix and a integer variable as global variables such that they can be accessed by all functions.

Functions have been discussed in the class, and you are free to define and use necessary functions, including recursive functions, in your codes.

After finishing editing your source file, you can execute the following command to compile it,
$ gcc lab06.c
If no compilation errors, the executable file, a.out, should be generated, and you can execute it by typing
$ ./a.out

After you finish verifying your program, you can submit your source code by
$ ee231002/bin/submit lab06 lab06.c
If you see a ”submitted successfully” message, then you are done. In case you want to check which file and at what time you submitted your labs, you can type in the following command:
$ ee231002/bin/subrec lab06
It will show the last few submission records.
2