Hey there! Hope you guys can help me out..

Here is my assignment:

1 2 3

2 3 1

3 1 2

Program Requirements: The program will prompt the user for the order of Latin Square

that the user desires (again, the above is order 3, which means 3x3; an order of 4 would

mean 4x4) and then generate a Latin Square of the requested order. The maximum order that

may be requested is 10.

The program will output the result in tabular form as above (without the boxes).

Extra Credit: For extra credit, once the Latin Square has been displayed, you may prompt the user to ask if they would like a different Latin Square of the same order, if they answer yes, then generate a new Latin Square of the same order. Hint: Randomizing your initial number choices makes this much easier.

------------------------------------------------------------------------------------

So basically, Sudoku puzzles are latin squares of 9x9. My goal is to generate completed ones, and not a solver, which was my original thought. I think this is easier...??

I've given it a go.. And it is very messy so I hope you'll bear with me.. haha.

```
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
bool numOK(int latinsq[][10], int row, int col, int size, int num);
int main()
{
int testnum = (rand() + time(0)) % 100; // <-- YUCK
int size;
int latinsq[10][10];
cout << "What order would you like your Latin Square to be?\n"
<< "(e.g. if you desire a 3x3 grid, just type: 3): ";
cin >> size;
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
/* Inside here I might change how I find a random number.. as the way I've done it above is pretty crappy. Do loop?*/
while (!numOK(latinsq,i,j,size,testnum));
latinsq[i][j] = testnum;
}
}
}
bool numOK(int latinsq[][10], int row, int col, int size, int num)
{
for (int i = 0; i < size; i++){
if (latinsq[row][i] == num)
{
return false;
}
}
for (int i = 0; i < size; i++){
if (latinsq[i][col] == num)
{
return false;
}
}
return true;
}
```

Right now it doesn't even compile, and I'm just stuck. If someone could point me in the right direction, it would help, or just give me some pointers? Thanks for everything in advance. =/