Yes, nested loops are the ticket.
the outer loop would be the char you start with:
Code:
for(letr = 'A'; letr < 'U'; letr++) {
//skip non base letters
if(letr == 'H')
letr = 'T';
if(letr != 'A' && letr != 'C' && letr != 'G && letr != 'T")
continue;
for(letr2 = 'A'; letr2 < 'U'; letr2++) {
//skip non base letters
if(letr == 'H')
letr = 'T';
if(letr != 'A' && letr != 'C' && letr != 'G && letr != 'T")
continue;
printf("%c%c ", letr, letr2);
}
}
This is just rough pseudo-code, not ready to run code, and may be too naive to handle this problem.
I have used this type of nested loop to handle 81 squares on Sudoku, and generate Trillions and Trillions (and much more than that), grids, so it is both robust and fast, but every problem is different.