public subroutine print_combos(out_array, count, max_len)
Print combinations stored in out_array
Uses int64 for count to handle large numbers of combinations that overflow int32.
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
integer(kind=default_int),
|
intent(in) |
|
|
:: |
out_array(:,:) |
|
|
integer(kind=int64),
|
intent(in) |
|
|
:: |
count |
|
|
integer(kind=default_int),
|
intent(in) |
|
|
:: |
max_len |
|
Variables
| Type |
Visibility | Attributes |
|
Name |
| Initial | |
|
integer(kind=int64),
|
private |
|
:: |
i |
|
|
|
|
integer(kind=default_int),
|
private |
|
:: |
j |
|
|
|
Source Code
subroutine print_combos(out_array, count, max_len)
!! Print combinations stored in out_array
!! Uses int64 for count to handle large numbers of combinations that overflow int32.
integer(default_int), intent(in) :: out_array(:, :), max_len
integer(int64), intent(in) :: count
integer(int64) :: i
integer(default_int) :: j
do i = 1_int64, count
do j = 1, max_len
if (out_array(i, j) == 0) exit
write (*, '(I0)', advance='no') out_array(i, j)
if (j < max_len .and. out_array(i, j + 1) /= 0) then
write (*, '(A)', advance='no') ":"
end if
end do
write (*, *) ! newline
end do
end subroutine print_combos